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.

45 lines
1.8 KiB

10 years ago
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # This module uses OpenERP, Open Source Management Solution Framework.
  5. # Copyright (C):
  6. # 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>
  20. #
  21. ##############################################################################
  22. from openerp.osv import orm
  23. class IrModelFields(orm.Model):
  24. _inherit = 'ir.model.fields'
  25. def search(
  26. self, cr, uid, args, offset=0, limit=0, order=None, context=None,
  27. count=False):
  28. model_domain = []
  29. for domain in args:
  30. if (len(domain) > 2 and
  31. domain[0] == 'model_id' and
  32. isinstance(domain[2], basestring)):
  33. model_domain += [
  34. ('model_id', 'in', map(int, domain[2][1:-1].split(',')))
  35. ]
  36. else:
  37. model_domain.append(domain)
  38. return super(IrModelFields, self).search(
  39. cr, uid, model_domain, offset=offset, limit=limit, order=order,
  40. context=context, count=count
  41. )