diff --git a/base_user_role/models/role.py b/base_user_role/models/role.py index 109a41692..14cfb920e 100644 --- a/base_user_role/models/role.py +++ b/base_user_role/models/role.py @@ -88,6 +88,13 @@ class ResUsersRoleLine(models.Model): date_from = fields.Date("From") date_to = fields.Date("To") is_enabled = fields.Boolean("Enabled", compute="_compute_is_enabled") + _sql_constraints = [ + ( + "user_role_uniq", + "unique (user_id,role_id)", + "Roles can be assigned to a user only once at a time", + ) + ] @api.depends("date_from", "date_to") def _compute_is_enabled(self): diff --git a/base_user_role/readme/CONTRIBUTORS.rst b/base_user_role/readme/CONTRIBUTORS.rst index b0539e398..b34cf97aa 100644 --- a/base_user_role/readme/CONTRIBUTORS.rst +++ b/base_user_role/readme/CONTRIBUTORS.rst @@ -3,5 +3,6 @@ * Jean-Charles Drubay (https://komit-consulting.com) * Alan Ramos (https://www.jarsa.com.mx) * Harald Panten +* Kevin Khao Do not contact contributors directly about support or help with technical issues. diff --git a/base_user_role/views/user.xml b/base_user_role/views/user.xml index 6625b414f..bf8bf1284 100644 --- a/base_user_role/views/user.xml +++ b/base_user_role/views/user.xml @@ -10,9 +10,13 @@ + - +