diff --git a/bemade_sethy_configuration/__manifest__.py b/bemade_sethy_configuration/__manifest__.py index a914723..94d0cc1 100644 --- a/bemade_sethy_configuration/__manifest__.py +++ b/bemade_sethy_configuration/__manifest__.py @@ -22,7 +22,8 @@ 'data/company_data.xml', 'data/partner_tags_data.xml', 'data/partner_relations_data.xml', - 'views/res_partner_relation.xml' + 'views/res_partner_views.xml', + 'views/res_partner_relation_views.xml' ], 'demo': [ # Reference to demo data files diff --git a/bemade_sethy_configuration/models/res_partner.py b/bemade_sethy_configuration/models/res_partner.py index 3df39d8..854ed8f 100644 --- a/bemade_sethy_configuration/models/res_partner.py +++ b/bemade_sethy_configuration/models/res_partner.py @@ -14,10 +14,41 @@ class ResPartner(models.Model): cyberimpact = fields.Boolean(string='Cyberimpact') specification_date = fields.Date(string='Specification date') crm_stage_activity = fields.Text(string='Activity Stage') - interest_level = fields.Selection(selection=[('1','None'), - ('2','Low'), - ('3','Average'), - ('4','High')], string='Interest Level') + + interest_level = fields.Selection( + selection=[ + ('1', 'None'), + ('2', 'Low'), + ('3', 'Average'), + ('4', 'High')], + string='Interest Level') + company_use = fields.Text(string='Company related') + relation_owner_ids = fields.One2many( + "res.partner.relation.all", + compute="_compute_owner_ids", + string="Owner ids" + ) + relation_property_ids = fields.One2many( + "res.partner.relation.all", + compute="_compute_property_ids", + string="Property ids" + ) + + @api.depends('relation_all_ids') + def _compute_owner_ids(self): + for record in self: + record.relation_owner_ids = record.relation_all_ids.filtered( + lambda line: ( + line.type_id.name == 'Owner' and not line.is_inverse) + ) + + @api.depends('relation_all_ids') + def _compute_property_ids(self): + for record in self: + record.relation_property_ids = record.relation_all_ids.filtered( + lambda line: ( + line.type_id.name == 'Owner' and line.is_inverse) + ) diff --git a/bemade_sethy_configuration/views/res_partner_relation.xml b/bemade_sethy_configuration/views/res_partner_relation_views.xml similarity index 100% rename from bemade_sethy_configuration/views/res_partner_relation.xml rename to bemade_sethy_configuration/views/res_partner_relation_views.xml diff --git a/bemade_sethy_configuration/views/res_partner_views.xml b/bemade_sethy_configuration/views/res_partner_views.xml new file mode 100644 index 0000000..d797237 --- /dev/null +++ b/bemade_sethy_configuration/views/res_partner_views.xml @@ -0,0 +1,65 @@ + + + + + bemade_sethy_configuration.res_partner.defaults.form + res.partner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file