1
0
mirror of https://gitlab.com/flectra-community/partner-contact.git synced 2025-01-21 02:31:44 +00:00
partner-contact/partner_property/models/res_partner.py

28 lines
880 B
Python
Raw Normal View History

2024-11-08 07:13:24 +00:00
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from flectra import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
properties_company_id = fields.Many2one(
compute="_compute_properties_company_id",
comodel_name="res.company",
)
properties_type_company = fields.Properties(
definition="properties_company_id.partner_properties_definition_company",
copy=True,
)
properties_type_person = fields.Properties(
definition="properties_company_id.partner_properties_definition_person",
copy=True,
)
@api.depends("company_id")
@api.depends_context("company")
def _compute_properties_company_id(self):
for item in self:
item.properties_company_id = item.company_id or self.env.company