Skip to content

[18.0][FIX] document_page_approval: 'Cancel' button visible for any user in draft, and in any state for owners/approvers - #656

Open
miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-fix-cancel-button-visibility
Open

miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-fix-cancel-button-visibility

Conversation

@miquelrosell99

Copy link
Copy Markdown

Problem

Same defect pattern as #655, in the Cancel button of the history form view:

invisible="(not am_i_owner or not am_i_approver) and (state not in ('draft', 'to approve'))"

Because the clauses are combined with and, the button is visible:

  • for any user while the state is draft or to approve (the user condition collapses), and
  • for any owner or approver in every state, including approved and cancelled (the state condition collapses).

Fix

Match the documented intent ("cancel if i am owner or approver"):

invisible="(not am_i_owner and not am_i_approver) or state not in ('draft', 'to approve')"

The button now shows only to owners or approvers, while the revision is draft or to approve. Note that action_cancel() itself performs no state or permission check, so this button is the only gate — with the old expression anyone opening a draft change request created by someone else could cancel it.

…for owner or approver

The button combined its clauses with 'and', so it was visible whenever
the user was owner or approver, in any state (including 'approved' and
'cancelled'), and also for any user while the state was 'draft' or
'to approve'.

Match the documented intent ("cancel if i am owner or approver"): the
button is now shown to owners or approvers while the revision is draft
or to approve.
@OCA-git-bot OCA-git-bot added series:18.0 mod:document_page_approval Module document_page_approval labels Oct 20, 2026
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 series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants