Skip to content

[18.0][FIX] document_page: do not copy history on page duplicate - #633

Open
miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-fix-document-page-copy-history
Open

[18.0][FIX] document_page: do not copy history on page duplicate#633
miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-fix-document-page-copy-history

Conversation

@miquelrosell99

@miquelrosell99 miquelrosell99 commented Jul 31, 2026

Copy link
Copy Markdown

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.

This PR adds copy=False on:

  • document.page.history_ids so duplicates start with a clean history.
  • document.page.history approval 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.

@OCA-git-bot OCA-git-bot added mod:document_page Module document_page series:18.0 mod:document_page_approval Module document_page_approval labels Jul 31, 2026
@miquelrosell99
miquelrosell99 force-pushed the 18.0-fix-document-page-copy-history branch from 75e0748 to 95bddc8 Compare July 31, 2026 09:31
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
miquelrosell99 force-pushed the 18.0-fix-document-page-copy-history branch from 95bddc8 to 7352bc5 Compare July 31, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:document_page_approval Module document_page_approval mod:document_page Module document_page series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants