Browse Source

[IMP] tempo

16.0
RemiFr82 6 months ago
parent
commit
16bac680fc
  1. 56
      crock_base/models/res_partner.py

56
crock_base/models/res_partner.py

@ -5,32 +5,32 @@ class ResPartner(models.Model):
_inherit = "res.partner"
_order = "is_company desc, country_id, country_department_id, display_name, id"
@api.onchange("state_id")
def _onchange_state_id(self):
state = self.state_id
if state:
if self.partner_scale in ["3", "4"]:
crck = self.search(
[("partner_scale", "=", "2"), ("state_id", "=", state)], limit=1
)
if crck and crck != self.crck_partner_id:
main = self.env.ref("base.main_partner")
if self.crck_partner_id != main:
self.crck_partner_id = main
elif self.partner_scale == "2":
self.crck_partner_id = self
# @api.onchange("state_id")
# def _onchange_state_id(self):
# state = self.state_id
# if state:
# if self.partner_scale in ["3", "4"]:
# crck = self.search(
# [("partner_scale", "=", "2"), ("state_id", "=", state)], limit=1
# )
# if crck and crck != self.crck_partner_id:
# main = self.env.ref("base.main_partner")
# if self.crck_partner_id != main:
# self.crck_partner_id = main
# elif self.partner_scale == "2":
# self.crck_partner_id = self
@api.onchange("country_department_id")
def _onchange_country_department_id(self):
dept = self.country_department_id
if dept and self.partner_scale == "4":
cdck = self.search(
[("partner_scale", "=", "3"), ("country_department_id", "=", dept)],
limit=1,
)
if cdck and cdck != self.cdck_partner_id:
main = self.env.ref("base.main_partner")
if self.cdck_partner_id != main:
self.cdck_partner_id = main
elif self.partner_scale == "3":
self.cdck_partner_id = self
# @api.onchange("country_department_id")
# def _onchange_country_department_id(self):
# dept = self.country_department_id
# if dept and self.partner_scale == "4":
# cdck = self.search(
# [("partner_scale", "=", "3"), ("country_department_id", "=", dept)],
# limit=1,
# )
# if cdck and cdck != self.cdck_partner_id:
# main = self.env.ref("base.main_partner")
# if self.cdck_partner_id != main:
# self.cdck_partner_id = main
# elif self.partner_scale == "3":
# self.cdck_partner_id = self
Loading…
Cancel
Save