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.

20 lines
679 B

  1. # Copyright 2020 Camptocamp SA
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
  3. from odoo import _, api, models
  4. from odoo.exceptions import AccessError
  5. class IrModule(models.Model):
  6. _inherit = 'ir.module.module'
  7. @api.multi
  8. def _import_module(self, module, path, force=False):
  9. group_xid = 'import_module_group.group_module_import'
  10. if not self.env.user.has_group(group_xid):
  11. group = self.env.ref(group_xid)
  12. raise AccessError(
  13. _("Only users with group %s are allowed to import modules")
  14. % group.name
  15. )
  16. return super()._import_module(module, path, force=force)