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.

28 lines
1.1 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, api
  4. class ResConfigSettings(models.TransientModel):
  5. _inherit = 'res.config.settings'
  6. def _partner_names_order_selection(self):
  7. options = super(
  8. ResConfigSettings, self)._partner_names_order_selection()
  9. new_labels = {
  10. 'last_first': 'Lastname SecondLastname Firstname',
  11. 'last_first_comma': 'Lastname SecondLastname, Firstname',
  12. 'first_last': 'Firstname Lastname SecondLastname',
  13. }
  14. return [(k, new_labels[k]) if k in new_labels else (k, v)
  15. for k, v in options]
  16. @api.multi
  17. def _partners_for_recalculating(self):
  18. return self.env['res.partner'].search([
  19. ('is_company', '=', False),
  20. '|', '&', ('firstname', '!=', False), ('lastname', '!=', False),
  21. '|', '&', ('firstname', '!=', False), ('lastname2', '!=', False),
  22. '&', ('lastname', '!=', False), ('lastname2', '!=', False),
  23. ])