From 44f99b7b41544fda8b37f8867ad7da20f0fbcd39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Mon, 11 Sep 2023 19:16:54 +0200 Subject: [PATCH] base_user_role - add (copy) in order to allow the duplicate --- base_user_role/models/role.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base_user_role/models/role.py b/base_user_role/models/role.py index 43c24733a..739782a47 100644 --- a/base_user_role/models/role.py +++ b/base_user_role/models/role.py @@ -3,7 +3,7 @@ import datetime import logging -from odoo import SUPERUSER_ID, api, fields, models +from odoo import SUPERUSER_ID, _, api, fields, models _logger = logging.getLogger(__name__) @@ -103,6 +103,11 @@ def unlink(self): users.set_groups_from_roles(force=True) return res + def copy(self, default=None): + self.ensure_one() + default = dict(default or {}, name=_("%s (copy)", self.name)) + return super().copy(default) + def update_users(self): """Update all the users concerned by the roles identified by `ids`.""" users = self.mapped("user_ids")