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
959B

  1. # Copyright 2022 Camptocamp SA (https://www.camptocamp.com).
  2. # @author Iván Todorovich <ivan.todorovich@camptocamp.com>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from odoo import models, api
  5. class ResPartner(models.Model):
  6. _inherit = "res.partner"
  7. def test_get_record_xml_id(self):
  8. return self.get_xml_id()[self.id]
  9. def test_loop_through_fields(self):
  10. group_fields = [f for f in self.fields_get_keys() if f.startswith("group_")]
  11. for group_field in group_fields:
  12. print(group_field)
  13. @api.model
  14. def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
  15. self.flush()
  16. self.invalidate_cache(['user_ids'], self._ids)
  17. args = args or []
  18. if name:
  19. name = name.split(' / ')[-1]
  20. args = [('name', operator, name)] + args
  21. return self._search(args, limit=limit, access_rights_uid=name_get_uid)
上海开阖软件有限公司 沪ICP备12045867号-1