[FIX] base: allow erp manager to set multi-company on a user
If a user member of group 'group_erp_manager' create a new user and adds the user in multiple companies, the system raises an AccessError on ir.ui.view When adding a user in multiple companies, he is automatically added in the 'base.group_multi_company' group. Modifying a 'res.group' record recomputes the view architecture. The ir.ui.view records is writable by 'base.group_system' users. Closes #21207
This commit is contained in:
@@ -775,6 +775,11 @@ class GroupsView(models.Model):
|
||||
xml = E.field(E.group(*(xml1), col="2"), E.group(*(xml2), col="4"), name="groups_id", position="replace")
|
||||
xml.addprevious(etree.Comment("GENERATED AUTOMATICALLY BY GROUPS"))
|
||||
xml_content = etree.tostring(xml, pretty_print=True, xml_declaration=True, encoding="utf-8")
|
||||
if not view.check_access_rights('write', raise_exception=False):
|
||||
# erp manager has the rights to update groups/users but not
|
||||
# to modify ir.ui.view
|
||||
if self.env.user.has_group('base.group_erp_manager'):
|
||||
view = view.sudo()
|
||||
view.with_context(lang=None).write({'arch': xml_content, 'arch_fs': False})
|
||||
|
||||
def get_application_groups(self, domain):
|
||||
|
||||
Reference in New Issue
Block a user