From bc9943f1886b2c6937af6f422f8fc9ef5f607c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 2 Feb 2022 12:01:32 +0000 Subject: [PATCH] [FIX] test_mail: re-add groups for notification, allowing bw tests To ease comparisons for query counters let us try to keep the same test flow through v15+. We therefore now also compute recipient groups for portal users for some test models, like before odoo/odoo@faeb5e7feea13e60783d66e4a5c95e2c52f55553 . Part-of: odoo/odoo#83832 --- addons/test_mail/models/test_mail_models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/test_mail/models/test_mail_models.py b/addons/test_mail/models/test_mail_models.py index 61aab7393b2..6520ad3adb8 100644 --- a/addons/test_mail/models/test_mail_models.py +++ b/addons/test_mail/models/test_mail_models.py @@ -80,6 +80,16 @@ class MailTestTicket(models.Model): user_id = fields.Many2one('res.users', 'Responsible', tracking=1) container_id = fields.Many2one('mail.test.container', tracking=True) + def _notify_get_recipients_groups(self, msg_vals=None): + """ Activate more groups to test query counters notably (and be backward + compatible for tests). """ + groups = super(MailTestTicket, self)._notify_get_recipients_groups(msg_vals=msg_vals) + for group_name, _group_method, group_data in groups: + if group_name == 'portal': + group_data['active'] = True + + return groups + def _track_template(self, changes): res = super(MailTestTicket, self)._track_template(changes) record = self[0] @@ -116,6 +126,16 @@ class MailTestContainer(models.Model): 'mail.alias', 'Alias', delegate=True) + def _notify_get_recipients_groups(self, msg_vals=None): + """ Activate more groups to test query counters notably (and be backward + compatible for tests). """ + groups = super(MailTestContainer, self)._notify_get_recipients_groups(msg_vals=msg_vals) + for group_name, _group_method, group_data in groups: + if group_name == 'portal': + group_data['active'] = True + + return groups + def _alias_get_creation_values(self): values = super(MailTestContainer, self)._alias_get_creation_values() values['alias_model_id'] = self.env['ir.model']._get('mail.test.container').id