diff --git a/partner_firstname/models/res_partner.py b/partner_firstname/models/res_partner.py
index 1222b3c4786e..99ed09168617 100644
--- a/partner_firstname/models/res_partner.py
+++ b/partner_firstname/models/res_partner.py
@@ -27,6 +27,22 @@ class ResPartner(models.Model):
readonly=False,
)
+ is_address_readonly = fields.Boolean(compute="_compute_contact_type")
+ is_individual = fields.Boolean(compute="_compute_contact_type")
+
+ @api.depends("is_company", "type", "parent_id")
+ def _compute_contact_type(self):
+ for partner in self:
+ partner.is_address_readonly = not (
+ partner.is_company
+ or not partner.parent_id
+ or partner.type not in ["contact"]
+ )
+ partner.is_individual = not partner.is_company and partner.type in [
+ "contact",
+ "other",
+ ]
+
@api.model
def name_fields_in_vals(self, vals):
"""Method to check if any name fields are in `vals`."""
diff --git a/partner_firstname/views/res_partner.xml b/partner_firstname/views/res_partner.xml
index dcbde6e9772a..ab55688aabd5 100644
--- a/partner_firstname/views/res_partner.xml
+++ b/partner_firstname/views/res_partner.xml
@@ -3,26 +3,22 @@
res.partner
+
+
+
is_company
- not is_company
- type == 'contract' and is_company
+ is_individual
+ is_individual
- is_company == False
- not is_company
- type == 'contract' and is_company
+ not is_company
+ is_company
-
-
-
+
+
+
@@ -31,55 +27,96 @@
res.partner
+
+
+
+
is_company
- not is_company
- type == 'contract' and is_company
+ is_individual
+ is_individual
not is_company
- not is_company
- type == 'contract' and is_company
+ is_company
-
+
+
+
+ is_address_readonly
+
+
+ is_address_readonly
+
+
+ is_address_readonly
+
+
+ is_address_readonly
+
+
+ is_address_readonly
+
+
+ is_address_readonly
+
+
- not is_company
- is_company
+ is_individual
+ is_individual
-
-
+
+