Repository navigation
[18.0][FIX] document_page: do not copy history on page duplicate - #633
Open
miquelrosell99 wants to merge 2 commits into
Open
miquelrosell99 wants to merge 2 commits into
miquelrosell99 wants to merge 2 commits into
Conversation
miquelrosell99
force-pushed
the
18.0-fix-document-page-copy-history
branch
2 times, most recently
from
July 31, 2026 09:54
95bddc8 to
7352bc5
Compare
When duplicating a document.page, the One2many history_ids field was being copied by default, so the new page inherited all past revisions including their current state. Add copy=False on document.page.history_ids so duplicates start with a clean history. Add copy=False on the approval-specific fields of document.page.history (state, approved_date, approved_uid) so a duplicated change request resets to draft and does not inherit approval metadata. In document_page_approval, override copy() so the duplicated page starts with a single draft change request containing the original content, rather than reusing copied histories or auto-advancing to 'to approve'. Add tests covering both behaviors.
miquelrosell99
force-pushed
the
18.0-fix-document-page-copy-history
branch
from
November 2, 2026 07:26
7352bc5 to
ee0c108
Compare
…e copy The base document_page.copy() writes content=self.content in its default, which overrides the content=False the approval copy() tried to pass; the content inverse then created a change request on top of the one created explicitly, leaving the duplicated page with two history records. Let the inverse create a single change request, but keep it in draft when the page requires approval so the copy starts the approval workflow from scratch instead of firing approval requests. When approval is not required the record is auto-approved as usual, so the copy keeps displaying its content.
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.
When duplicating a
document.page, the One2manyhistory_idsfield was being copied by default, so the new page inherited all past revisions including their current state.This PR adds
copy=Falseon:document.page.history_idsso duplicates start with a clean history.document.page.historyapproval fields (state,approved_date,approved_uid) so a duplicated change request resets to draft and does not inherit approval metadata.Tests are included for both behaviors.