[IMP] core: remove user_has_groups()

Simply align the documentation with the new API and usage of method
user.has_group().

closes odoo/documentation#8131

Related: odoo/odoo#151597
Related: odoo/upgrade#5616
Related: odoo/enterprise#55523
Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
Raphael Collet 2024-03-13 10:15:51 +01:00
parent 858089caf7
commit cb948c7f05
2 changed files with 7 additions and 7 deletions

View File

@ -451,12 +451,12 @@ The urls in the actions list can be generated automatically by calling the
new_group = (
'group_trip_manager',
lambda partner: bool(partner.user_ids) and
any(user.has_group('business.group_trip_manager')
for user in partner.user_ids),
{
'actions': trip_actions,
})
lambda partner: any(
user.sudo().has_group('business.group_trip_manager')
for user in partner.user_ids
),
{'actions': trip_actions},
)
return [new_group] + groups

View File

@ -213,7 +213,7 @@ can not be trusted, ACL being only verified during CRUD operations.
# this method is public and its arguments can not be trusted
def action_done(self):
if self.state == "draft" and self.user_has_groups('base.manager'):
if self.state == "draft" and self.env.user.has_group('base.manager'):
self._set_state("done")
# this method is private and can only be called from other python methods