From 308c5b38e2c76c8ff8dd15fef96dfe9a66c4ada8 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Wed, 17 Jan 2024 14:04:00 +0000 Subject: [PATCH] [FIX] sale_purchase: cancel order wizard warn about PO when there's none To reproduce on runbot: - edit the access rights of internal user 'lauriepoiret' and grant she the group "Sales / User: own document only" (and ensure she does not have the group "Purchase / User") - as 'lauriepoiret', create a sale order for a product without 'service subcontracting' (ex. Bacon Burger) and confirm it - click on "Cancel" button In the wizard and warning is shown: ``` There are active purchase orders linked to this sale order that are not cancelled automatically! ``` As the user is not a member of `Purchase / User`, he has no right to read the `display_purchase_orders_alert` field which prevent the invisible attrs to be correctly evaluated, showing the warning in all cases even when there is no purchase order linked This commit restrict the PO warning to the same `Purchase / User` group to ensure that warning information is coherent closes odoo/odoo#151968 X-original-commit: 6086d6fcc87128a72bad055a9a749c5329c6e901 Signed-off-by: William Henrotin (whe) --- addons/sale_purchase/wizards/sale_order_cancel_views.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_purchase/wizards/sale_order_cancel_views.xml b/addons/sale_purchase/wizards/sale_order_cancel_views.xml index e67655ad8a5..e5c9656f1fe 100644 --- a/addons/sale_purchase/wizards/sale_order_cancel_views.xml +++ b/addons/sale_purchase/wizards/sale_order_cancel_views.xml @@ -9,7 +9,8 @@ + invisible="not display_purchase_orders_alert" + groups="purchase.group_purchase_user"> There are active purchase orders linked to this sale order that are not cancelled automatically!