From 8fbee7978f154bfd7d1424709cd66796cb3d82f3 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 12 Sep 2017 17:13:22 +0200 Subject: [PATCH] [FIX] purchase: PO state when validated When nothing has been invoiced and the PO is validated with nothing to invoice then the state of the PO must be "Nothing to invoice" opw:769919 --- 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 9ff1ee0ebf1..7cd1132d89e 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -57,7 +57,7 @@ class PurchaseOrder(models.Model): if any(float_compare(line.qty_invoiced, line.product_qty if line.product_id.purchase_method == 'purchase' else line.qty_received, precision_digits=precision) == -1 for line in order.order_line): order.invoice_status = 'to invoice' - elif all(float_compare(line.qty_invoiced, line.product_qty if line.product_id.purchase_method == 'purchase' else line.qty_received, precision_digits=precision) >= 0 for line in order.order_line): + elif all(float_compare(line.qty_invoiced, line.product_qty if line.product_id.purchase_method == 'purchase' else line.qty_received, precision_digits=precision) >= 0 for line in order.order_line) and order.invoice_ids: order.invoice_status = 'invoiced' else: order.invoice_status = 'no'