[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
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user