[IMP] base_user_role: action to group groups into a role

This commit is contained in:
ArnauCForgeFlow
2024-01-25 11:00:21 +01:00
parent e6b15bb611
commit fbd99ca40b
6 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# Copyright 2021 Sodexis
# License OPL-1 (See LICENSE file for full copyright and licensing details).
from odoo import fields, models
class GroupGroupsIntoRole(models.TransientModel):
"""
This wizard is used to group different groups into a role.
"""
_name = "group.groups.into.role"
_description = "Group groups into a role"
name = fields.Char(
required=True,
help="Group groups into a role and specify a name for this role",
)
def create_role(self):
selected_group_ids = self.env.context.get("selected_group_ids", [])
vals = {
"name": self.name,
"implied_ids": selected_group_ids,
}
self.env["res.users.role"].create(vals)