[IMP] partner_profiles: refactor has_position boolean computation
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "partner_profiles",
|
||||
"version": "12.0.1.0.2",
|
||||
"version": "12.0.1.0.3",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"maintainer": "Stéphan Sainléger",
|
||||
|
@@ -22,7 +22,7 @@ class res_partner(models.Model):
|
||||
is_position_profile = fields.Boolean(
|
||||
compute="_compute_profile_booleans", store=True
|
||||
)
|
||||
has_position = fields.Boolean(compute="_compute_profile_booleans", store=True)
|
||||
has_position = fields.Boolean(compute="_compute_has_position", store=True)
|
||||
|
||||
# If current partner is Main partner, this field indicates what its public profile is.
|
||||
public_profile_id = fields.Many2one(
|
||||
@@ -50,6 +50,10 @@ class res_partner(models.Model):
|
||||
partner.is_position_profile = (
|
||||
partner.partner_profile.ref == "partner_profile_position"
|
||||
)
|
||||
|
||||
@api.depends("other_contact_ids")
|
||||
def _compute_has_position(self):
|
||||
for partner in self:
|
||||
partner.has_position = len(partner.other_contact_ids) > 0
|
||||
|
||||
@api.depends("partner_profile", "contact_id")
|
||||
|
Reference in New Issue
Block a user