diff options
| author | Sébastien Theys <seb@odoo.com> | 2019-09-23 12:40:20 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-09-23 20:55:39 +0000 |
| commit | 9112972e155cbced84f9e1082a4b229a5b3e1fd9 (patch) | |
| tree | 386b394fa22ce0d671286a760dd58fb07db7901a /addons/web/static/src/js | |
| parent | 50c7941fa67133a29c3a1032f799a1135950198c (diff) | |
[IMP] fields: write only once per Image field
Before this commit, flushing a model that uses the `image.mixin` would generate
twice as many queries as it should.
This is because `_compute_related` is not meant to be overridden. In the
override of `Image` we call `super()` then post process the records by
reassigning each record's relevant image field with `_image_process`.
The `super()` will assign the field of the records once which
will in turn trigger a `write` (and thus, will generate queries) then
after the `super()` call we reassign them which will re-trigger the same
`write` and the same queries.
With this commit, instead of overriding `_compute_related` we extract the
processing to a method that can be overridden, so that the `write` is called
simply once.
The result, obviously, is that queries related to the `write` are cut in half.
Related PR: #36683 & #36288
Co-authored-by: Adrian Torres <adt@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
0 files changed, 0 insertions, 0 deletions
