diff --git a/mail_template_substitute/README.rst b/mail_template_substitute/README.rst index 3421c57b1..9227fe5d8 100644 --- a/mail_template_substitute/README.rst +++ b/mail_template_substitute/README.rst @@ -14,14 +14,14 @@ Mail Template Substitute :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/12.0/mail_template_substitute + :target: https://github.com/OCA/social/tree/16.0/mail_template_substitute :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_template_substitute + :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_template_substitute :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/12.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=16.0 + :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,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. @@ -72,6 +72,7 @@ Contributors ~~~~~~~~~~~~ * Bejaoui Souheil +* Karthik Maintainers ~~~~~~~~~~~ @@ -86,6 +87,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/mail_template_substitute/__init__.py b/mail_template_substitute/__init__.py index 1c15bc7ee..aee8895e7 100644 --- a/mail_template_substitute/__init__.py +++ b/mail_template_substitute/__init__.py @@ -1,3 +1,2 @@ from . import models from . import wizards -from . import tests diff --git a/mail_template_substitute/__manifest__.py b/mail_template_substitute/__manifest__.py index fe33d0936..b6ab9b9a3 100644 --- a/mail_template_substitute/__manifest__.py +++ b/mail_template_substitute/__manifest__.py @@ -6,7 +6,7 @@ "summary": """ This module allows to create substitution rules for mail templates. """, - "version": "12.0.1.0.1", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", diff --git a/mail_template_substitute/i18n/mail_template_substitute.pot b/mail_template_substitute/i18n/mail_template_substitute.pot index da3ee1976..a6245bf68 100644 --- a/mail_template_substitute/i18n/mail_template_substitute.pot +++ b/mail_template_substitute/i18n/mail_template_substitute.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/mail_template_substitute/models/mail_template.py b/mail_template_substitute/models/mail_template.py index 109fc2605..ddc598dc6 100644 --- a/mail_template_substitute/models/mail_template.py +++ b/mail_template_substitute/models/mail_template.py @@ -1,13 +1,11 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models -from odoo.tools import pycompat +from odoo import fields, models from odoo.tools.safe_eval import safe_eval class MailTemplate(models.Model): - _inherit = "mail.template" mail_template_substitution_rule_ids = fields.One2many( @@ -16,12 +14,11 @@ class MailTemplate(models.Model): string="Substitution Rules", ) - @api.multi def _get_substitution_template(self, model_id, active_ids): self.ensure_one() - if isinstance(active_ids, pycompat.integer_types): + if isinstance(active_ids, int): active_ids = [active_ids] - model = self.env[model_id.model] + model = self.env[model_id.sudo().model] for substitution_template_rule in self.mail_template_substitution_rule_ids: domain = safe_eval(substitution_template_rule.domain) domain.append(("id", "in", active_ids)) @@ -29,9 +26,8 @@ class MailTemplate(models.Model): return substitution_template_rule.substitution_mail_template_id return False - @api.multi - def get_email_template(self, res_ids): + def _classify_per_lang(self, res_ids, engine="inline_template"): substitution_template = self._get_substitution_template(self.model_id, res_ids) if substitution_template: - return substitution_template.get_email_template(res_ids) - return super().get_email_template(res_ids) + return substitution_template._classify_per_lang(res_ids, engine=engine) + return super()._classify_per_lang(res_ids, engine=engine) diff --git a/mail_template_substitute/models/mail_template_substitution_rule.py b/mail_template_substitute/models/mail_template_substitution_rule.py index 0670493e6..02d92be58 100644 --- a/mail_template_substitute/models/mail_template_substitution_rule.py +++ b/mail_template_substitute/models/mail_template_substitution_rule.py @@ -15,7 +15,7 @@ class MailTemplateSubstitutionRule(models.Model): comodel_name="mail.template", required=True, ondelete="cascade" ) model = fields.Char(related="mail_template_id.model_id.model", store=True) - domain = fields.Char(string="Domain", required=True, default="[]") + domain = fields.Char(required=True, default="[]") substitution_mail_template_id = fields.Many2one( comodel_name="mail.template", required=True, diff --git a/mail_template_substitute/readme/CONTRIBUTORS.rst b/mail_template_substitute/readme/CONTRIBUTORS.rst index 35c03ffe0..5b0a4d9eb 100644 --- a/mail_template_substitute/readme/CONTRIBUTORS.rst +++ b/mail_template_substitute/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Bejaoui Souheil +* Karthik diff --git a/mail_template_substitute/static/description/index.html b/mail_template_substitute/static/description/index.html index 5d8c4311a..4c7bc50f3 100644 --- a/mail_template_substitute/static/description/index.html +++ b/mail_template_substitute/static/description/index.html @@ -3,7 +3,7 @@ - + Mail Template Substitute