[FIX] base: fix xml_id creation of custom groups
Steps to reproduce: - Go to "Settings / Users & Companies / Groups" - Create a group (e.g. Group X) - Go to "Settings / Technical / Actions / Server Actions" - Create a server action: * Model: [any] (e.g. Contact) * Action To Do: Execute Python Code * Python Code: [any] * Security: Group X - Create contextual action - Connect with a non-admin user (i.e. Marc Demo) - Open Contacts app => An Access Error is raised: "You are not allowed to create 'Model Data' (ir.model.data) records. This operation is allowed for the following groups: - Administration/Access Rights Contact your administrator to request access if necessary." Cause: When the group is created, its external identifier is not created directly. When opening Contacts app, the list of authorized actions is evaluated. During the process, "_ensure_xml_id" is called on the groups configured on the actions to create the missing external identifiers. However, the current user (i.e. Marc Demo) has not the rights to create an external identifier. opw-3328506 closes odoo/odoo#148503 X-original-commit: 34af4c8e6b4273688881b37bfba33d457054676c Signed-off-by: Denis Ledoux (dle) <dle@odoo.com> Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
This commit is contained in:
@@ -230,7 +230,7 @@ class Groups(models.Model):
|
||||
result = self.get_external_id()
|
||||
missings = {group_id: f'__custom__.group_{group_id}' for group_id, ext_id in result.items() if not ext_id}
|
||||
if missings:
|
||||
self.env['ir.model.data'].create(
|
||||
self.env['ir.model.data'].sudo().create(
|
||||
[
|
||||
{
|
||||
'name': name.split('.')[1],
|
||||
|
||||
Reference in New Issue
Block a user