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

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 - Ursa Information Systems <http://ursainfosystems.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
  4. from openerp import api, models
  5. class ResUsers(models.Model):
  6. _inherit = 'res.users'
  7. @api.v7
  8. def get_export_models(self, cr, uid):
  9. return self.fetch_export_models(cr, uid)
  10. @api.v8
  11. def get_export_models(self):
  12. uid = self.id or self.env.uid
  13. return self.fetch_export_models(self.env.cr, uid)
  14. def fetch_export_models(self, cr, uid):
  15. groups_id = [group.id for group in self.browse(cr, uid, uid).groups_id]
  16. accessobj = self.pool['ir.model.access']
  17. accessobj_ids = accessobj.search(cr, uid, [('perm_export','=',True),('group_id','in',groups_id)])
  18. model_names = [access_obj.model_id.model for access_obj in accessobj.browse(cr, uid, accessobj_ids)]
  19. #make distinct value in list
  20. model_names = list(set(model_names))
  21. return model_names