From 5588c2e02bf7d96b3a07f2d8160e2a531f00d467 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 25 Apr 2018 15:35:42 +0200 Subject: [PATCH] [FIX] purchase: Wrong behavior of "Received product" button on purchase order Steps to reproduce the bug: - Create a stockable product P - Create PO and confirm it - Cancel the PO - Reset the PO to Draft and reconfirm it - Validate shipment order Bug: - The "Receive product" button is still displayed but every shipment orders of the PO have been treated. NB: The field is_shipped is only used to display the button "Received product". opw:1838539 --- addons/purchase/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 6c1700c177c..a39b0c82328 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -92,7 +92,7 @@ class PurchaseOrder(models.Model): @api.depends('picking_ids', 'picking_ids.state') def _compute_is_shipped(self): for order in self: - if order.picking_ids and all([x.state == 'done' for x in order.picking_ids]): + if order.picking_ids and all([x.state in ['done', 'cancel'] for x in order.picking_ids]): order.is_shipped = True READONLY_STATES = {