diff options
| author | Xavier Morel <xmo@odoo.com> | 2019-02-28 10:58:33 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2019-02-28 10:58:33 +0000 |
| commit | f9d3b5b7dfe15fb53f14fa0a0ae91bbeded9939b (patch) | |
| tree | 7068ba5b7092b3d7dd05b4972cdfb93eda065235 | |
| parent | 373afe2498e232ccd04b325472423e5468aab1f5 (diff) | |
[FIX] core: order of fields in onchange of SSF
When calling the initial (create / default_get) onchange, the SSF
would send the list of fields in whatever order was provided by the
fields map of fields_view_get.
The web client uses view ordering, and it turns out some uses / tests
have dependencies between onchanges (e.g. _create_payment in
test_account_reports) which break on some orderings of the fields.
Send the initial onchange using view-ordered fields in the SSF as
well.
closes odoo/odoo#31494
| -rw-r--r-- | odoo/tests/common.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/odoo/tests/common.py b/odoo/tests/common.py index ff89997ef4b..c41bdb99955 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -1174,8 +1174,11 @@ class Form(object): # pre-resolve modifiers & bind to arch toplevel modifiers = fvg['modifiers'] = {} contexts = fvg['contexts'] = {} + order = fvg['fields_ordered'] = [] for f in fvg['tree'].xpath('//field[not(ancestor::field)]'): fname = f.get('name') + order.append(fname) + modifiers[fname] = { modifier: domain if isinstance(domain, bool) else normalize_domain(domain) for modifier, domain in json.loads(f.get('modifiers', '{}')).items() @@ -1223,7 +1226,8 @@ class Form(object): # on creation, every field is considered changed by the client # apparently - self._perform_onchange(list(vals.keys() - {'id'})) + # and fields should be sent in view order, not whatever fields_view_get['fields'].keys() is + self._perform_onchange(self._view['fields_ordered']) def _init_from_values(self, values): self._values.update( |
