Repository navigation
[19.0][FIX] document_page: history_head after content edit - #649
Open
XtremXpert wants to merge 1 commit into
Open
XtremXpert wants to merge 1 commit into
XtremXpert wants to merge 1 commit into
Conversation
history_ids is not sorted by _order in the cache: the revision created by write() is appended last, so history_ids[0] kept pointing to the previous revision and the edited content was lost on reload. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diverse-cite-claude
Bot
force-pushed
the
19.0-fix-document_page-history_head
branch
from
October 8, 2026 10:58
97b1516 to
c42a247
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After editing the content of a page,
history_headkeeps pointing to the previous revision. On reload, the page shows the old content, so the edit looks lost (the newdocument.page.historyrecord exists, but it is not the head)._compute_history_headtakeshistory_ids[0], relying on_order = "id DESC". In the cache, however, the revision created by_inverse_content()duringwrite()is appended at the end ofhistory_ids, sohistory_ids[0]is still the old revision when the storedhistory_headis recomputed.Fix
Pick the newest revision explicitly:
history_ids.sorted("id", reverse=True)[:1].Tests
New
test_page_edit_keeps_new_content: create a page, write new content, flush and invalidate, then check the head and the content.On
odoo:19.0(Odoo Server 19.0-20260926):1 failed, 0 error(s) of 10 tests(document.page.history(10,) != document.page.history(11,))0 failed, 0 error(s) of 10 testsThe same issue and fix apply to the 20.0 migration (#647).
🤖 Generated with Claude Code