You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.4 KiB

6 months ago
6 months ago
  1. from odoo import models, api
  2. class ResPartner(models.Model):
  3. _inherit = "res.partner"
  4. _order = "is_company desc, display_name, id"
  5. # @api.onchange("state_id")
  6. # def _onchange_state_id(self):
  7. # state = self.state_id
  8. # if state:
  9. # if self.partner_scale in ["3", "4"]:
  10. # crck = self.search(
  11. # [("partner_scale", "=", "2"), ("state_id", "=", state)], limit=1
  12. # )
  13. # if crck and crck != self.crck_partner_id:
  14. # main = self.env.ref("base.main_partner")
  15. # if self.crck_partner_id != main:
  16. # self.crck_partner_id = main
  17. # elif self.partner_scale == "2":
  18. # self.crck_partner_id = self
  19. # @api.onchange("country_department_id")
  20. # def _onchange_country_department_id(self):
  21. # dept = self.country_department_id
  22. # if dept and self.partner_scale == "4":
  23. # cdck = self.search(
  24. # [("partner_scale", "=", "3"), ("country_department_id", "=", dept)],
  25. # limit=1,
  26. # )
  27. # if cdck and cdck != self.cdck_partner_id:
  28. # main = self.env.ref("base.main_partner")
  29. # if self.cdck_partner_id != main:
  30. # self.cdck_partner_id = main
  31. # elif self.partner_scale == "3":
  32. # self.cdck_partner_id = self