From a55c47ad4219c1fb1b4e350dd6f332d0553cd75f Mon Sep 17 00:00:00 2001 From: RemiFr82 Date: Sun, 26 May 2024 16:36:38 +0200 Subject: [PATCH] [IMP] crock_base --- crock_base/i18n/fr.po | 21 +++++++++++++++++++++ crock_base/models/res_partner.py | 11 ++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 crock_base/i18n/fr.po diff --git a/crock_base/i18n/fr.po b/crock_base/i18n/fr.po new file mode 100644 index 0000000..6606470 --- /dev/null +++ b/crock_base/i18n/fr.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crock_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0-20230613\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-05-26 14:22+0000\n" +"PO-Revision-Date: 2024-05-26 14:22+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crock_base +#: model:ir.model,name:crock_base.model_res_partner +msgid "Contact" +msgstr "" diff --git a/crock_base/models/res_partner.py b/crock_base/models/res_partner.py index 9c359e0..a775a6e 100644 --- a/crock_base/models/res_partner.py +++ b/crock_base/models/res_partner.py @@ -3,7 +3,7 @@ from odoo import models, api class ResPartner(models.Model): _inherit = "res.partner" - _order = "is_company desc, country_id, department_id, display_name, id" + _order = "is_company desc, country_id, country_department_id, display_name, id" @api.onchange("state_id") def _onchange_state_id(self): @@ -20,12 +20,13 @@ class ResPartner(models.Model): elif self.partner_scale == "reg": self.crck_partner_id = self - @api.onchange("department_id") - def _onchange_department_id(self): - dept = self.department_id + @api.onchange("country_department_id") + def _onchange_country_department_id(self): + dept = self.country_department_id if dept and self.partner_scale == "loc": cdck = self.search( - [("partner_scale", "=", "dep"), ("department_id", "=", dept)], limit=1 + [("partner_scale", "=", "dep"), ("country_department_id", "=", dept)], + limit=1, ) if cdck and cdck != self.cdck_partner_id: main = self.env.ref("base.main_partner")