[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) <whe@odoo.com>
This commit is contained in:
Xavier ALT
2024-01-31 17:13:58 +00:00
committed by William Henrotin
parent a3befcc5a9
commit 308c5b38e2
@@ -9,7 +9,8 @@
</field>
<span id="display_invoice_alert" position="after">
<span id="display_purchase_orders_alert"
invisible="not display_purchase_orders_alert">
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! <br/>
</span>
</span>