[FIX] res_partner: a partner is portal if he has no employee users
Currently, a partner is considered a portal
if he has no users
or
if at least one of his users is portal.
This causes problems if an employee has two users,
one portal, one employee
and gets notified in a thread (e.g. @ Marc demo):
The email sent won't contain the action buttons (e.g. view opportunity)
because the employee is considered as portal.
A partner of an employee can have multiple users
linked if at some point two partners were merged,
and the partners had each a user, one a portal
and the other an employee.
This revision changes this behavior,
to consider a user as not portal (employee)
if one of its users is not a portal (an employee).
This is uniform with to the behavior of the
`share` field of `res.users`,
which is `True` when the user is part of the group employee.
```
user.share = not user.has_group('base.group_user')
```
opw-1914103
closes odoo/odoo#30314
This commit is contained in:
@@ -258,10 +258,10 @@ class Partner(models.Model):
|
||||
for partner in self:
|
||||
partner.tz_offset = datetime.datetime.now(pytz.timezone(partner.tz or 'GMT')).strftime('%z')
|
||||
|
||||
@api.depends('user_ids.share')
|
||||
@api.depends('user_ids.share', 'user_ids.active')
|
||||
def _compute_partner_share(self):
|
||||
for partner in self:
|
||||
partner.partner_share = not partner.user_ids or any(user.share for user in partner.user_ids)
|
||||
partner.partner_share = not partner.user_ids or not any(not user.share for user in partner.user_ids)
|
||||
|
||||
@api.depends(lambda self: self._display_address_depends())
|
||||
def _compute_contact_address(self):
|
||||
|
||||
Reference in New Issue
Block a user