Browse Source

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

14.0
Alexis de Lattre 8 years ago
committed by Jesús Alan Ramos Rodríguez
parent
commit
9b43d67edf
  1. 8
      base_user_role/i18n/ca.po
  2. 16
      base_user_role/i18n/pt.po
  3. 5
      base_user_role/models/user.py
  4. 2
      base_user_role/views/user.xml

8
base_user_role/i18n/ca.po

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-22 00:55+0000\n"
"PO-Revision-Date: 2017-02-22 00:55+0000\n"
"POT-Creation-Date: 2017-08-01 02:44+0000\n"
"PO-Revision-Date: 2017-08-01 02:44+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"MIME-Version: 1.0\n"
@ -134,7 +134,7 @@ msgid "Role"
msgstr ""
#. module: base_user_role
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_line_ids_1497
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_line_ids_1510
msgid "Role lines"
msgstr ""
@ -189,7 +189,7 @@ msgstr ""
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_users
#: model:ir.ui.view,arch_db:base_user_role.view_res_users_role_form
msgid "Users"
msgstr ""
msgstr "Usuaris"
#. module: base_user_role
#: model:ir.model,name:base_user_role.model_res_users_role_line

16
base_user_role/i18n/pt.po

@ -3,15 +3,15 @@
# * base_user_role
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# Pedro Castro Silva <pedrocs@sossia.pt>, 2016
# OCA Transbot <transbot@odoo-community.org>, 2017
# Pedro Castro Silva <pedrocs@sossia.pt>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-17 02:07+0000\n"
"PO-Revision-Date: 2016-12-17 02:07+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@sossia.pt>, 2016\n"
"POT-Creation-Date: 2017-08-01 02:44+0000\n"
"PO-Revision-Date: 2017-08-01 02:44+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@sossia.pt>, 2017\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -135,7 +135,7 @@ msgid "Role"
msgstr ""
#. module: base_user_role
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_line_ids_1519
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_line_ids_1510
msgid "Role lines"
msgstr ""
@ -190,7 +190,7 @@ msgstr ""
#: model:ir.model.fields,field_description:base_user_role.field_res_users_role_users
#: model:ir.ui.view,arch_db:base_user_role.view_res_users_role_form
msgid "Users"
msgstr ""
msgstr "Utilizadores"
#. module: base_user_role
#: model:ir.model,name:base_user_role.model_res_users_role_line

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