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.

26 lines
881 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. def get_export_models(self):
  8. self.env.cr.execute("SELECT model "
  9. "FROM ir_model "
  10. "WHERE id IN ("
  11. " SELECT distinct(model_id) "
  12. " FROM ir_model_access "
  13. " WHERE perm_export=TRUE AND group_id IN ("
  14. " SELECT gid "
  15. " FROM res_groups_users_rel "
  16. " WHERE uid=%s"
  17. " )"
  18. ")",
  19. (self.env.uid,))
  20. model_names = [r[0] for r in self.env.cr.fetchall()]
  21. return model_names