From 42a76d484ddaa90c5c025163886b6277488c482d Mon Sep 17 00:00:00 2001 From: miquelrosell99 <38435442+miquelrosell99@users.noreply.github.com> Date: Tue, 20 Oct 2026 10:39:45 +0200 Subject: [PATCH] [FIX] document_page_approval: show 'Back to draft' only on cancelled revisions The button was visible whenever the user was owner or approver, in any state, and also for any user while the state was 'cancelled' or 'to approve'. action_draft() rejects anything but state 'cancelled', so users got a UserError from a visible button. Align the visibility with the server-side check: owner or approver, and state 'cancelled'. --- document_page_approval/__manifest__.py | 2 +- document_page_approval/views/document_page_approval.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/document_page_approval/__manifest__.py b/document_page_approval/__manifest__.py index a05d537df8a..7dd6f53fd73 100644 --- a/document_page_approval/__manifest__.py +++ b/document_page_approval/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Document Page Approval", - "version": "18.0.1.2.0", + "version": "18.0.1.2.1", "author": "Savoir-faire Linux, Odoo Community Association (OCA)", "website": "https://github.com/OCA/knowledge", "license": "AGPL-3", diff --git a/document_page_approval/views/document_page_approval.xml b/document_page_approval/views/document_page_approval.xml index 87cdf3c4dc4..2a1441ea017 100644 --- a/document_page_approval/views/document_page_approval.xml +++ b/document_page_approval/views/document_page_approval.xml @@ -44,7 +44,7 @@ name="action_draft" type="object" string="Back to draft" - invisible="(not am_i_owner or not am_i_approver) and (state not in ('cancelled', 'to approve'))" + invisible="(not am_i_owner and not am_i_approver) or state != 'cancelled'" groups="document_page.group_document_manager" />