Skip to content
Snippets Groups Projects
Commit 83f9a3e2 authored by Sébastien Theys's avatar Sébastien Theys
Browse files

[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
parent 89270ee3
No related branches found
No related tags found
No related merge requests found
......@@ -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),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment