summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2018-08-31 08:55:18 +0200
committerNicolas Lempereur <nle@odoo.com>2018-08-31 12:02:21 +0200
commit79e18ac6afd290a438527d6bfa7fa8d00977a3e2 (patch)
treee08ba8d7d17baa1e9a0b7b78ff4fcf929f1de9ae
parent43877095eded098da4747dccbd2aea71143d0337 (diff)
[FIX] base: user fields_get no add group if asked
The override of fields_get adds "virtual" fields corresponding to groups. If for example we make "res.users" have inherit "mail.thread", we get these "virtual" field as if they had "track_visibility", since we do a "fields_get" with fields having track_visibility expecting to only get back "track_visibility" ones. So the system would then fail trying to track visibility on fields like "in_group_5" and for example a res.users could not be created anymore. With this fix, we fix the fields_get so it respect the fields we ask of it. fixes #22332 opw-1878654 closes #22338 closes #26705 Co-authored-by: Wolfgang Pichler <wpichler@callino.at>
-rw-r--r--odoo/addons/base/res/res_users.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/odoo/addons/base/res/res_users.py b/odoo/addons/base/res/res_users.py
index b1cbb386c9e..866ab65ec85 100644
--- a/odoo/addons/base/res/res_users.py
+++ b/odoo/addons/base/res/res_users.py
@@ -921,9 +921,12 @@ class UsersView(models.Model):
# add reified groups fields
for app, kind, gs in self.env['res.groups'].sudo().get_groups_by_application():
if kind == 'selection':
+ field_name = name_selection_groups(gs.ids)
+ if allfields and field_name not in allfields:
+ continue
# selection group field
tips = ['%s: %s' % (g.name, g.comment) for g in gs if g.comment]
- res[name_selection_groups(gs.ids)] = {
+ res[field_name] = {
'type': 'selection',
'string': app.name or _('Other'),
'selection': [(False, '')] + [(g.id, g.name) for g in gs],
@@ -934,7 +937,10 @@ class UsersView(models.Model):
else:
# boolean group fields
for g in gs:
- res[name_boolean_group(g.id)] = {
+ field_name = name_boolean_group(g.id)
+ if allfields and field_name not in allfields:
+ continue
+ res[field_name] = {
'type': 'boolean',
'string': g.name,
'help': g.comment,