Browse Source

[IMP] base_user_role: UX improvements

14.0
KevinKhao 4 years ago
parent
commit
3127164937
  1. 7
      base_user_role/models/role.py
  2. 1
      base_user_role/readme/CONTRIBUTORS.rst
  3. 6
      base_user_role/views/user.xml

7
base_user_role/models/role.py

@ -92,6 +92,13 @@ class ResUsersRoleLine(models.Model):
company_id = fields.Many2one(
"res.company", "Company", default=lambda self: self.env.user.company_id
)
_sql_constraints = [
(
"user_role_uniq",
"unique (user_id,role_id)",
"Roles can be assigned to a user only once at a time",
)
]
@api.constrains("user_id", "company_id")
def _check_company(self):

1
base_user_role/readme/CONTRIBUTORS.rst

@ -3,5 +3,6 @@
* Jean-Charles Drubay <jc@komit-consulting.com> (https://komit-consulting.com)
* Alan Ramos <alan.ramos@jarsa.com.mx> (https://www.jarsa.com.mx)
* Harald Panten <harald.panten@sygel.es>
* Kevin Khao <kevin.khao@akretion.com>
Do not contact contributors directly about support or help with technical issues.

6
base_user_role/views/user.xml

@ -10,9 +10,13 @@
<field name="arch" type="xml">
<xpath expr="//notebook/page[1]" position="before">
<page string="Roles">
<field name="role_ids" invisible="1" />
<field name="role_line_ids" nolabel="1">
<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_to" />
<field name="is_enabled" />

Loading…
Cancel
Save