[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@faeb5e7fee .

Part-of: odoo/odoo#83832
This commit is contained in:
Thibault Delavallée
2022-02-02 18:14:54 +00:00
parent f9736c0238
commit bc9943f188
@@ -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