diff options
| author | Yannick Tivisse <yti@odoo.com> | 2018-09-07 16:55:14 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-09-10 14:23:43 +0200 |
| commit | b7e6f281005bced15cc8226b2ba1a3e5edab7a00 (patch) | |
| tree | 676b390534adc059e2a69bf9d8b51f4c659f32b1 | |
| parent | c3717f3018ce0571aa41f70da4262cc946d883b4 (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/models/res_users.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index eb649d3943f..98adaf968bc 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -1047,9 +1047,12 @@ class UsersView(models.Model): selection_vals = [(False, '')] if app.xml_id == 'base.module_category_user_type': selection_vals = [] + 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': selection_vals + [(g.id, g.name) for g in gs], @@ -1060,7 +1063,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, |
