Browse Source

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

pull/897/head
Alexis de Lattre 8 years ago
committed by Jairo Llopis
parent
commit
b537941d5a
  1. 5
      base_user_role/models/user.py
  2. 2
      base_user_role/views/user.xml

5
base_user_role/models/user.py

@ -44,8 +44,9 @@ class ResUsers(models.Model):
lambda rec: rec.is_enabled)
for role_line in role_lines:
role = role_line.role_id
group_ids.append(role.group_id.id)
group_ids.extend(role.implied_ids.ids)
if role:
group_ids.append(role.group_id.id)
group_ids.extend(role.implied_ids.ids)
group_ids = list(set(group_ids)) # Remove duplicates IDs
vals = {
'groups_id': [(6, 0, group_ids)],

2
base_user_role/views/user.xml

@ -12,7 +12,7 @@
<page string="Roles">
<field name="role_line_ids" nolabel="1">
<tree editable="bottom" colors="grey: not is_enabled;">
<field name="role_id"/>
<field name="role_id" required="1"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="is_enabled"/>

Loading…
Cancel
Save