diff --git a/document_page_approval/README.rst b/document_page_approval/README.rst index 87f5f23bfcd..26bda85b7c0 100644 --- a/document_page_approval/README.rst +++ b/document_page_approval/README.rst @@ -106,6 +106,10 @@ Contributors - Bhavesh Heliconia +- `NuoBiT Solutions SL `__: + + - Deniz Gallo dgallo@nuobit.com + Maintainers ----------- diff --git a/document_page_approval/models/document_page_history.py b/document_page_approval/models/document_page_history.py index f8572e361ad..bddb9f66bb4 100644 --- a/document_page_approval/models/document_page_history.py +++ b/document_page_approval/models/document_page_history.py @@ -1,4 +1,5 @@ # Copyright (C) 2013 Savoir-faire Linux (). +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -133,6 +134,21 @@ def action_approve(self): def action_cancel(self): """Set a change request as cancelled.""" + for rec in self: + if rec.state not in ["draft", "to approve"]: + raise UserError( + self.env._( + "Can't cancel change requests in '%(state)s' state.", + state=rec.state, + ) + ) + if not (rec.am_i_owner or rec.am_i_approver): + raise UserError( + self.env._( + "You are not authorized to do this.\n" + "Only owners or approvers can cancel Change Requests." + ) + ) self.write({"state": "cancelled"}) for rec in self: rec.message_post( diff --git a/document_page_approval/readme/CONTRIBUTORS.md b/document_page_approval/readme/CONTRIBUTORS.md index 6cc0b9a99cf..30d03d4677c 100644 --- a/document_page_approval/readme/CONTRIBUTORS.md +++ b/document_page_approval/readme/CONTRIBUTORS.md @@ -18,3 +18,5 @@ - Fernando La Chica \<\> - [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) - Bhavesh Heliconia +- [NuoBiT Solutions SL](https://www.nuobit.com): + - Deniz Gallo diff --git a/document_page_approval/static/description/index.html b/document_page_approval/static/description/index.html index 33111d83084..b347bde7427 100644 --- a/document_page_approval/static/description/index.html +++ b/document_page_approval/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Document Page Approval