diff options
| author | Sébastien Theys <seb@odoo.com> | 2019-10-11 10:20:40 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-11 17:42:04 +0000 |
| commit | f294ccdb032df7bec5271a426a924b0865a6c079 (patch) | |
| tree | a42f70a11d0fcc16f97591e5b858801f11b9fa77 /addons/website/models/ir_ui_view.py | |
| parent | bc4b7c503673db29b0ea0d4a2b780378173fe3eb (diff) | |
[FIX] website: ensure the cache of the pages stay consistent with COW
This is necessary when writing view fields from a page record because the
generic page will put the given values on its cache but in reality the values
were only meant to go on the specific page. Invalidate all fields and not only
those in vals because other fields could have been changed implicitly too.
Pr: #37363
X-original-commit: 83f9a3e2608db34a319b985271d73f7de5bc73a1
Diffstat (limited to 'addons/website/models/ir_ui_view.py')
| -rw-r--r-- | addons/website/models/ir_ui_view.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 7c92478d231..628869b6b94 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -64,6 +64,16 @@ class View(models.Model): super(View, view).write(vals) continue + # Ensure the cache of the pages stay consistent when doing COW. + # This is necessary when writing view fields from a page record + # because the generic page will put the given values on its cache + # but in reality the values were only meant to go on the specific + # page. Invalidate all fields and not only those in vals because + # other fields could have been changed implicitly too. + pages = view.page_ids + pages.flush(records=pages) + pages.invalidate_cache(ids=pages.ids) + # If already a specific view for this generic view, write on it website_specific_view = view.search([ ('key', '=', view.key), |
