[FIX] core: avoid hiding access error in onchange() with Form
When the server-side form view reads its record, the call to web_read() leaves data in cache, which may prevent some access error to be triggered in the first call to onchange(). In order to avoid that, simply clean up the environment like after the other method calls. Part-of: odoo/odoo#148997
This commit is contained in:
@@ -283,7 +283,11 @@ class Form:
|
||||
""" Initialize the form for an existing record. """
|
||||
assert self._record.id, "editing unstored records is not supported"
|
||||
self._values.clear()
|
||||
|
||||
[record_values] = self._record.web_read(self._view['fields_spec'])
|
||||
self._env.flush_all()
|
||||
self._env.clear() # discard cache and pending recomputations
|
||||
|
||||
values = convert_read_to_form(record_values, self._view['fields'])
|
||||
self._values.update(values)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user