mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
@@ -88,6 +88,13 @@ class ResUsersRoleLine(models.Model):
|
|||||||
date_from = fields.Date("From")
|
date_from = fields.Date("From")
|
||||||
date_to = fields.Date("To")
|
date_to = fields.Date("To")
|
||||||
is_enabled = fields.Boolean("Enabled", compute="_compute_is_enabled")
|
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")
|
@api.depends("date_from", "date_to")
|
||||||
def _compute_is_enabled(self):
|
def _compute_is_enabled(self):
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
* Jean-Charles Drubay <jc@komit-consulting.com> (https://komit-consulting.com)
|
* Jean-Charles Drubay <jc@komit-consulting.com> (https://komit-consulting.com)
|
||||||
* Alan Ramos <alan.ramos@jarsa.com.mx> (https://www.jarsa.com.mx)
|
* Alan Ramos <alan.ramos@jarsa.com.mx> (https://www.jarsa.com.mx)
|
||||||
* Harald Panten <harald.panten@sygel.es>
|
* Harald Panten <harald.panten@sygel.es>
|
||||||
|
* Kevin Khao <kevin.khao@akretion.com>
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|||||||
@@ -10,9 +10,13 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//notebook/page[1]" position="before">
|
<xpath expr="//notebook/page[1]" position="before">
|
||||||
<page string="Roles">
|
<page string="Roles">
|
||||||
|
<field name="role_ids" invisible="1" />
|
||||||
<field name="role_line_ids" nolabel="1">
|
<field name="role_line_ids" nolabel="1">
|
||||||
<tree editable="bottom" decoration-muted="not is_enabled">
|
<tree editable="bottom" decoration-muted="not is_enabled">
|
||||||
<field name="role_id" />
|
<field
|
||||||
|
name="role_id"
|
||||||
|
domain="[('id', 'not in', parent.role_ids)]"
|
||||||
|
/>
|
||||||
<field name="date_from" />
|
<field name="date_from" />
|
||||||
<field name="date_to" />
|
<field name="date_to" />
|
||||||
<field name="is_enabled" />
|
<field name="is_enabled" />
|
||||||
|
|||||||
Reference in New Issue
Block a user