[FIX] mail: fix wrong override of write

Somehow a context parameter was still given to write. This should not happen
in new API (Odoo v8).

Task-2631873
PR odoo/odoo#75571
This commit is contained in:
Thibault Delavallée
2021-08-25 13:12:11 +00:00
parent 1b4e0099d4
commit 18191b9055
+3 -3
View File
@@ -13,11 +13,11 @@ class ResGroups(models.Model):
_inherit = 'res.groups'
_description = 'Access Groups'
def write(self, vals, context=None):
write_res = super(ResGroups, self).write(vals)
def write(self, vals):
res = super(ResGroups, self).write(vals)
if vals.get('users'):
# form: {'group_ids': [(3, 10), (3, 3), (4, 10), (4, 3)]} or {'group_ids': [(6, 0, [ids]}
user_ids = [command[1] for command in vals['users'] if command[0] == 4]
user_ids += [id for command in vals['users'] if command[0] == 6 for id in command[2]]
self.env['mail.channel'].search([('group_ids', 'in', self._ids)])._subscribe_users_automatically()
return write_res
return res