diff --git a/email_template_qweb/README.rst b/email_template_qweb/README.rst index 9500d8159..605af144f 100644 --- a/email_template_qweb/README.rst +++ b/email_template_qweb/README.rst @@ -14,13 +14,13 @@ QWeb for email templates :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github - :target: https://github.com/OCA/social/tree/13.0/email_template_qweb + :target: https://github.com/OCA/social/tree/14.0/email_template_qweb :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-email_template_qweb + :target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-email_template_qweb :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/205/13.0 + :target: https://runbot.odoo-community.org/runbot/205/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -51,7 +51,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -74,6 +74,14 @@ Contributors * Ernesto Tejeda * Thomas Fossoul (thomas@niboo.com) +* Phuc Tran Thanh + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Camptocamp Maintainers ~~~~~~~~~~~ @@ -88,6 +96,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/social `_ project on GitHub. +This module is part of the `OCA/social `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/email_template_qweb/__manifest__.py b/email_template_qweb/__manifest__.py index 6fecc88b9..c63b07c26 100644 --- a/email_template_qweb/__manifest__.py +++ b/email_template_qweb/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "QWeb for email templates", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "author": "Therp BV, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Marketing", diff --git a/email_template_qweb/models/mail_template.py b/email_template_qweb/models/mail_template.py index f3adcdf16..7a3831906 100644 --- a/email_template_qweb/models/mail_template.py +++ b/email_template_qweb/models/mail_template.py @@ -15,22 +15,24 @@ class MailTemplate(models.Model): body_view_id = fields.Many2one("ir.ui.view", domain=[("type", "=", "qweb")]) body_view_arch = fields.Text(related="body_view_id.arch") - def generate_email(self, res_ids, fields=None): + def generate_email(self, res_ids, fields): multi_mode = True if isinstance(res_ids, int): res_ids = [res_ids] multi_mode = False result = super(MailTemplate, self).generate_email(res_ids, fields=fields) - for res_id, template in self.get_email_template(res_ids).items(): - if template.body_type == "qweb" and (not fields or "body_html" in fields): - for record in self.env[template.model].browse(res_id): - body_html = template.body_view_id.render( - {"object": record, "email_template": template} + for res_id in res_ids: + if self.body_type == "qweb" and (not fields or "body_html" in fields): + for record in self.env[self.model].browse(res_id): + body_html = self.body_view_id._render( + {"object": record, "email_template": self} ) # Some wizards, like when sending a sales order, need this # fix to display accents correctly body_html = tools.ustr(body_html) - result[res_id]["body_html"] = self.render_post_process(body_html) + result[res_id]["body_html"] = self._render_template_postprocess( + {res_id: body_html} + )[res_id] result[res_id]["body"] = tools.html_sanitize( result[res_id]["body_html"] ) diff --git a/email_template_qweb/readme/CONTRIBUTORS.rst b/email_template_qweb/readme/CONTRIBUTORS.rst index e20e6e921..cf30deb81 100644 --- a/email_template_qweb/readme/CONTRIBUTORS.rst +++ b/email_template_qweb/readme/CONTRIBUTORS.rst @@ -6,3 +6,4 @@ * Ernesto Tejeda * Thomas Fossoul (thomas@niboo.com) +* Phuc Tran Thanh diff --git a/email_template_qweb/readme/CREDITS.rst b/email_template_qweb/readme/CREDITS.rst new file mode 100644 index 000000000..f5cc070c7 --- /dev/null +++ b/email_template_qweb/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Camptocamp diff --git a/email_template_qweb/static/description/index.html b/email_template_qweb/static/description/index.html index 9d00cbf6c..8a2640e58 100644 --- a/email_template_qweb/static/description/index.html +++ b/email_template_qweb/static/description/index.html @@ -3,7 +3,7 @@ - + QWeb for email templates