[FIX] partner_profiles: remove writes to removed customer/supplier fields
In Odoo 16 the ``customer`` and ``supplier`` boolean fields on ``res.partner`` were replaced by the ``customer_rank`` / ``supplier_rank`` integer counters, but the migration kept the block forcing them to ``False`` for public profiles. Any creation of a public profile therefore raised ``AttributeError: 'res.partner' object has no attribute 'customer'``, which also broke main profile creation through ``create_public_profile``. Remove the dead block instead of porting it to the new fields: ranks default to 0 and are only incremented on invoice posting through ``_increase_rank`` on the commercial partner, so a public profile never becomes a customer or supplier anyway. The original intent is preserved without redundant writes.
This commit is contained in:
@@ -127,10 +127,6 @@ class res_partner(models.Model):
|
|||||||
and not res.public_profile_id
|
and not res.public_profile_id
|
||||||
):
|
):
|
||||||
res.create_public_profile()
|
res.create_public_profile()
|
||||||
if res.partner_profile.ref == "partner_profile_public": #TODO: replace by check on boolean is_public_profile ? Is this boolean computed at this step of the process?
|
|
||||||
# Public profile can't be customer or supplier. Only main or position profiles can
|
|
||||||
res.customer = False
|
|
||||||
res.supplier = False
|
|
||||||
else:
|
else:
|
||||||
res = super(res_partner, self).create(vals)
|
res = super(res_partner, self).create(vals)
|
||||||
return res
|
return res
|
||||||
|
|||||||
Reference in New Issue
Block a user