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.

37 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from openerp import models
  4. class IRActionsWindow(models.Model):
  5. _inherit = 'ir.actions.act_window'
  6. # do not use new api, as read can return a single id or multi...
  7. # def read(self, fields=None, load='_classic_read'):
  8. def read(self, cr, uid, ids,
  9. fields=None, context=None, load='_classic_read'):
  10. """ call the method get_empty_list_help of the model and set the
  11. window action help message
  12. """
  13. ids_int = isinstance(ids, (int, long))
  14. if ids_int:
  15. ids = [ids]
  16. actions = super(IRActionsWindow, self).read(
  17. cr, uid, ids, fields=fields, context=context, load=load)
  18. for action in actions:
  19. if action.get('res_model', '') == 'res.partner':
  20. # By default, only show standalone contact
  21. action_context = action.get('context', '{}') or '{}'
  22. if 'search_show_all_positions' not in action_context:
  23. action['context'] = action_context.replace(
  24. '{',
  25. ("{'search_show_all_positions': "
  26. "{'is_set': True, 'set_value': False},"),
  27. 1)
  28. if ids_int:
  29. return actions[0]
  30. return actions