Browse Source

Revert "[FIX] Crash in base_user_role when role_id is not set on res.users.role.line"

This reverts commit b537941d5a.
14.0
Pierrick Brun 6 years ago
committed by Jesús Alan Ramos Rodríguez
parent
commit
afc6eaf947
  1. 3
      base_user_role/models/user.py
  2. 2
      base_user_role/views/user.xml

3
base_user_role/models/user.py

@ -70,8 +70,7 @@ class ResUsers(models.Model):
lambda rec: rec.is_enabled) lambda rec: rec.is_enabled)
for role_line in role_lines: for role_line in role_lines:
role = role_line.role_id role = role_line.role_id
if role:
group_ids += role_groups[role]
group_ids += role_groups[role]
group_ids = list(set(group_ids)) # Remove duplicates IDs group_ids = list(set(group_ids)) # Remove duplicates IDs
groups_to_add = list(set(group_ids) - set(user.groups_id.ids)) groups_to_add = list(set(group_ids) - set(user.groups_id.ids))
groups_to_remove = list(set(user.groups_id.ids) - set(group_ids)) groups_to_remove = list(set(user.groups_id.ids) - set(group_ids))

2
base_user_role/views/user.xml

@ -13,7 +13,7 @@
<page string="Roles"> <page string="Roles">
<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" required="1"/>
<field name="role_id"/>
<field name="date_from"/> <field name="date_from"/>
<field name="date_to"/> <field name="date_to"/>
<field name="is_enabled"/> <field name="is_enabled"/>

Loading…
Cancel
Save