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.

35 lines
1.2 KiB

  1. # Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import models
  4. class ResConfigSettings(models.TransientModel):
  5. _inherit = "res.config.settings"
  6. def _partner_names_order_selection(self):
  7. options = super(ResConfigSettings, self)._partner_names_order_selection()
  8. new_labels = {
  9. "last_first": "Lastname SecondLastname Firstname",
  10. "last_first_comma": "Lastname SecondLastname, Firstname",
  11. "first_last": "Firstname Lastname SecondLastname",
  12. }
  13. return [(k, new_labels[k]) if k in new_labels else (k, v) for k, v in options]
  14. def _partners_for_recalculating(self):
  15. return self.env["res.partner"].search(
  16. [
  17. ("is_company", "=", False),
  18. "|",
  19. "&",
  20. ("firstname", "!=", False),
  21. ("lastname", "!=", False),
  22. "|",
  23. "&",
  24. ("firstname", "!=", False),
  25. ("lastname2", "!=", False),
  26. "&",
  27. ("lastname", "!=", False),
  28. ("lastname2", "!=", False),
  29. ]
  30. )