[18.0][ADD] new module: mail_template_conditional_report#40
[18.0][ADD] new module: mail_template_conditional_report#40
Conversation
|
@OCA/mail-maintainers is it possible to review this PR please? 🦸 |
ad7b053 to
a570128
Compare
This module is used to add condition (domain) on dynamic reports during generation of mail.template. When the mail is generated (based on the mail template), all dynamic attachments are generated (by standard Odoo) then the domain is applied (based on the record) to know if the attachment should be dropped or not.
a570128 to
70e3e51
Compare
hbrunn
left a comment
There was a problem hiding this comment.
@acsonefho you don't need to ping maintainers 5 days after submission, we get more than enough noise as it is
| ALTER TABLE mail_template_ir_actions_report_rel | ||
| ADD COLUMN id SERIAL PRIMARY KEY; | ||
| """ | ||
| env.cr.execute(query) |
There was a problem hiding this comment.
add an uninstall hook to undo this
| attachments = values.pop("attachments", []) | ||
| validated_attachments = [] | ||
| for template_report, attachment in zip( | ||
| self.mail_template_report_ids, attachments, strict=True |
There was a problem hiding this comment.
how do you guarantee those are ordered the same?
| <list> | ||
| <field | ||
| name="ir_actions_report_id" | ||
| options="{'no_create': True, 'no_open': True}" |
| return TRUE_DOMAIN | ||
| return safe_eval( | ||
| self.filter_domain, | ||
| { |
There was a problem hiding this comment.
I'd suggest to put this into its own function for easy customization by other modules
The goal was to have opinion's members at the beginning to avoid full rewrite after few months. |
There was a problem hiding this comment.
Recycling my remark from #97 (which may interest you as well):
In Odoo, 'full' ir.model.access permissions are granted on the mail.template model to all users as is the case here, but these are amended by record rules specifying that regular users can only control their own templates: https://github.com/odoo/odoo/blob/18.0/addons/mail/security/mail_security.xml#L265-L285. Would you consider doing the same here (i.e. regular users can only create/write/delete conditional report configurations linked to the templates that they own), and editor/manager groups can edit all conditional attachments?
This module is used to add condition (domain) on dynamic reports during generation of mail.template. When the mail is generated (based on the mail template), all dynamic attachments are generated (by standard Odoo) then the domain is applied (based on the record) to know if the attachment should be dropped or not.