[FIX] account: only put internal users as followers of vendor bills (2)
Fine-tuning of 0a4e67c609.
Due to some confusion, has_group had been replaced by user_has_groups
on the corresponding PR.
However the latter is not a higher-level version of the former,
since it checks the groups on the self.env.user, not on self.
As a result, the filtering was completely False, since it checked that the env
user was in group_user which was always True.
closes odoo/odoo#32653
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
@@ -703,7 +703,7 @@ class AccountInvoice(models.Model):
|
||||
# Subscribe internal users on the newly created bill
|
||||
partners = self.env['res.partner'].browse(seen_partner_ids)
|
||||
is_internal = lambda p: (p.user_ids and
|
||||
all(p.user_ids.mapped(lambda u: u.user_has_groups('base.group_user'))))
|
||||
all(p.user_ids.mapped(lambda u: u.has_group('base.group_user'))))
|
||||
partners_to_subscribe = partners.filtered(is_internal)
|
||||
if partners_to_subscribe:
|
||||
invoice.message_subscribe([p.id for p in partners_to_subscribe])
|
||||
|
||||
Reference in New Issue
Block a user