From 70648b064d16539b33066f59fe9b390cb27475ca Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Fri, 3 Mar 2023 16:26:19 +0000 Subject: [PATCH] [FIX] base: add `commercial_company_name` to the depends MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: if you add a custom one2many field to the 'res.partner', like x_related_commercial_partner_ids, that is related to the `commercial_partner_id` in the`res.partner` model, it won't update the display name of a contact in case of changing its parent_id name. Here are the steps to reproduce the problem: 1. Create a new custom field with these values: a. Field Type = one2many b. Model = Contact c. Related Model = res.partner d. Relation Field = commercial_partner_id 2. Create a new Contact that is the "Company" (e.g. "My Company") 3. Create a new Contact that is the "Individual" (e.g. "My Name"), and put the "My Company" as its parent_id. 4. Now the display_name is "My Company, My Name" which is correct 5. Change the company name to "My new Company" -> display_name won't change, and is "My Company, My Name" The solution is to add the 'commercial_company_name' to the `display_name` depends. opw-3202894 closes odoo/odoo#120908 X-original-commit: f242cad9a27fb0e58e1b9c726573b316534f6be8 Signed-off-by: Rémy Voet Signed-off-by: Xavier Morel (xmo) --- odoo/addons/base/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index 82ba9d56252..aa2792fc7e2 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -327,7 +327,7 @@ class Partner(models.Model): return "base/static/img/money.png" return super()._avatar_get_placeholder_path() - @api.depends('is_company', 'name', 'parent_id.display_name', 'type', 'company_name') + @api.depends('is_company', 'name', 'parent_id.display_name', 'type', 'company_name', 'commercial_company_name') def _compute_display_name(self): # retrieve name_get() without any fancy feature names = dict(self.with_context({}).name_get())