-
- Downloads
[REF] mail: clean code about rendering in mail_template
PURPOSE Clean and rename code about language management and template rendering in mail template model. SPECIFICATIONS Clean method naming and try to make code easier to understand and call. Also add and/or clean docstrings of rendering methods. Notably * ``_classify_per_lang``: for each lang-contextualized template, give the list of record ids; * ``_render_template``: now working only on a valid list of IDs instead of allowing both int / list and having a return type depending on the input type. It allows to simplify code and delegate some processing to callers; Introduce new API method * ``_render_lang``: for each record id return the lang matching it; * ``_render_field``: render a field of mail.template, on given set of record ids. Usage: template._render_field('body_html', records.ids). Language computation is available for this method; Remove the "multi mode" support of rendering that either returned a rendered value, either a dict based on given ids. Now all methods always work in batch and caller have to fetch the correct result if necessary. LINKS Task ID 1963529 Community PR odoo/odoo#32397
Showing
- addons/account/models/account_move.py 5 additions, 5 deletionsaddons/account/models/account_move.py
- addons/digest/models/digest.py 2 additions, 1 deletionaddons/digest/models/digest.py
- addons/gamification/models/challenge.py 2 additions, 6 deletionsaddons/gamification/models/challenge.py
- addons/gamification/models/goal.py 1 addition, 4 deletionsaddons/gamification/models/goal.py
- addons/l10n_ch/models/mail_template.py 12 additions, 13 deletionsaddons/l10n_ch/models/mail_template.py
- addons/mail/models/mail_template.py 162 additions, 86 deletionsaddons/mail/models/mail_template.py
- addons/mail/models/mail_thread.py 2 additions, 1 deletionaddons/mail/models/mail_thread.py
- addons/mass_mailing/models/mail_template.py 9 additions, 8 deletionsaddons/mass_mailing/models/mail_template.py
- addons/portal/__init__.py 3 additions, 3 deletionsaddons/portal/__init__.py
- addons/purchase/models/purchase.py 1 addition, 1 deletionaddons/purchase/models/purchase.py
- addons/sale/models/sale.py 1 addition, 1 deletionaddons/sale/models/sale.py
- addons/survey/wizard/survey_invite.py 2 additions, 2 deletionsaddons/survey/wizard/survey_invite.py
- addons/website_slides/models/slide_slide.py 2 additions, 2 deletionsaddons/website_slides/models/slide_slide.py
- addons/website_slides/wizard/slide_channel_invite.py 2 additions, 2 deletionsaddons/website_slides/wizard/slide_channel_invite.py
Loading
Please register or sign in to comment