Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0]base_user_role - add (copy) in order to allow the duplicate #237

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Loading