-
-
Notifications
You must be signed in to change notification settings - Fork 105
[18.0][ADD] new module: mail_template_conditional_report #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you guarantee those are ordered the same?
| <list> | ||
| <field | ||
| name="ir_actions_report_id" | ||
| options="{'no_create': True, 'no_open': True}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why no_open?
| return TRUE_DOMAIN | ||
| return safe_eval( | ||
| self.filter_domain, | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.