Browse Source

[IMP] crock_base

16.0
RemiFr82 6 months ago
parent
commit
a55c47ad42
  1. 21
      crock_base/i18n/fr.po
  2. 11
      crock_base/models/res_partner.py

21
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 ""

11
crock_base/models/res_partner.py

@ -3,7 +3,7 @@ from odoo import models, api
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = "res.partner" _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") @api.onchange("state_id")
def _onchange_state_id(self): def _onchange_state_id(self):
@ -20,12 +20,13 @@ class ResPartner(models.Model):
elif self.partner_scale == "reg": elif self.partner_scale == "reg":
self.crck_partner_id = self 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": if dept and self.partner_scale == "loc":
cdck = self.search( 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: if cdck and cdck != self.cdck_partner_id:
main = self.env.ref("base.main_partner") main = self.env.ref("base.main_partner")

Loading…
Cancel
Save