Skip to content

Commit

Permalink
base_user_role - add (copy) in order to allow the duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
jdidderen-noviat committed Sep 11, 2023
1 parent 17b2f08 commit 44f99b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base_user_role/models/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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)

Check warning on line 109 in base_user_role/models/role.py

View check run for this annotation

Codecov / codecov/patch

base_user_role/models/role.py#L107-L109

Added lines #L107 - L109 were not covered by tests

def update_users(self):
"""Update all the users concerned by the roles identified by `ids`."""
users = self.mapped("user_ids")
Expand Down

0 comments on commit 44f99b7

Please sign in to comment.