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

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