[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
This commit is contained in:
Goffin Simon
2017-09-13 10:16:34 +02:00
parent 7f356d6653
commit 8fbee7978f
+1 -1
View File
@@ -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'