[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
This commit is contained in:
Goffin Simon
2018-04-26 09:22:20 +02:00
parent 0c76bd3c63
commit 5588c2e02b
+1 -1
View File
@@ -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 = {