diff options
| author | Raphael Collet <rco@openerp.com> | 2016-10-26 10:51:23 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2016-10-28 13:29:53 +0200 |
| commit | eb326e669e991e5dadfa6a4aa3245b7077613821 (patch) | |
| tree | 20e298c63e124693d2f18bd7be0a86f0a38d9578 /addons/web_editor/static/src/less/web_editor.ui.components.less | |
| parent | 25616b9f2bbca3f03dbde1dc81a57986241c1aab (diff) | |
[FIX] fields: prevent base setup on fields shared across registries
A field shared across registries is normally never setup from scratch, except
when its full setup cannot complete. This happens when a registry reuses that
field but fails to load, because the base and full setup of fields look like:
def setup_base(self, model, name):
if self.setup_full_done:
# optimization: keep base setup (1)
self.setup_full_done = False
else:
# do the base setup from scratch (2)
...
def setup_full(self, model):
if not self.setup_full_done:
# complete full setup (3)
self.setup_full_done = True
When the field is reused for the first time, its setup state `setup_full_done`
is reset to `False` (1), and it should be set to `True` again after completion
of full setup (3). However, because the full setup fails, the field remains
with `setup_full_done` equal to `False`.
In that situation, when the same field is reused again, it base setup will be
done from scratch (2), and therefore some attributes (like `column`) are reset
to their initial value. Because the full setup fails again, those attributes
are lost for other registries that share the field.
Fix this crap by precising the setup states: `None`, `'base'` and `'full'`.
When a field is reused, its setup state is reset to `'base'` instead of `None`,
and consequently it will never be setup from scratch again.
Diffstat (limited to 'addons/web_editor/static/src/less/web_editor.ui.components.less')
0 files changed, 0 insertions, 0 deletions
