From f2d95dfd7c14e837c530a86aab6f930be1054377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 20 Dec 2024 08:19:49 +0100 Subject: [PATCH] [IMP] mail_notification_custom_subject: Make the subject_template field translatable TT52259 --- .../models/mail_message_custom_subject.py | 1 + .../test_mail_notification_custom_subject.py | 24 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/mail_notification_custom_subject/models/mail_message_custom_subject.py b/mail_notification_custom_subject/models/mail_message_custom_subject.py index 4c8db6a8c2..0340b56305 100644 --- a/mail_notification_custom_subject/models/mail_message_custom_subject.py +++ b/mail_notification_custom_subject/models/mail_message_custom_subject.py @@ -23,6 +23,7 @@ class MailMessageCustomSubject(models.Model): ) subject_template = fields.Char( required=True, + translate=True, help="Subject (placeholders may be used here)", ) position = fields.Selection( diff --git a/mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py b/mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py index 622b7aa8e9..02bc64a45e 100644 --- a/mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py +++ b/mail_notification_custom_subject/tests/test_mail_notification_custom_subject.py @@ -2,29 +2,27 @@ # Copyright 2022 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # pylint: disable=C8107 -from odoo.tests import common +from odoo.tests import new_test_user from odoo.tools import mute_logger +from odoo.addons.base.tests.common import BaseCommon -class TestMailNotificationCustomSubject(common.TransactionCase): + +class TestMailNotificationCustomSubject(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() - cls.partner_1, cls.partner_2 = ( - cls.env["res.partner"] - .with_context(tracking_disable=True) - .create( - [ - {"name": "Test partner 1", "email": "partner1@example.com"}, - {"name": "Test partner 2", "email": "partner2@example.com"}, - ] - ) + cls.partner_1, cls.partner_2 = cls.env["res.partner"].create( + [ + {"name": "Test partner 1", "email": "partner1@example.com"}, + {"name": "Test partner 2", "email": "partner2@example.com"}, + ] ) - cls.admin = common.new_test_user(cls.env, "boss", "base.group_system") + cls.admin = new_test_user(cls.env, "boss", "base.group_system") def setUp(self): super().setUp() - self.uid = common.new_test_user(self.env, "worker") + self.uid = new_test_user(self.env, "worker") def test_email_subject_template_overrides(self): with self.with_user("boss"):