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.

27 lines
1.1 KiB

  1. # © 2016 Serpent Consulting Services Pvt. Ltd. (support@serpentcs.com)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. class IrModelFields(models.Model):
  5. _inherit = 'ir.model.fields'
  6. @api.model
  7. def search(self, args, offset=0, limit=0, order=None, count=False):
  8. model_domain = []
  9. if not self.env.context.get('mass_edit', False):
  10. model_domain = args
  11. else:
  12. for domain in args:
  13. if (len(domain) > 2 and domain[0] == 'model_id' and
  14. isinstance(domain[2], str) and
  15. list(domain[2][1:-1])):
  16. model_ids = list(map(int, domain[2][1:-1].split(',')))
  17. model_domain += [('model_id', 'in', model_ids)]
  18. else:
  19. model_domain.append(domain)
  20. return super(IrModelFields, self).search(args=model_domain,
  21. offset=offset,
  22. limit=limit, order=order,
  23. count=count)