From f18399f721592d2dd90641c7e9350e19839641d7 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 17 Nov 2015 13:40:37 +0100 Subject: [PATCH] [FIX] purchase: invoice state of PO If the invoicing policy of a PO is set to "Based on incoming shipments" and the PO contains a product of type "service", it is never considered as invoiced, and therefore reach the state "Done". The reason is that no stock move is linked to this PO line, and therefore it is never considered as invoiced since we check the invoice state of the associated sotck moves. This fix assumes that in this specific case, a PO line for a service is always invoiced, since there is anyway no incoming shipment linked to it. opw-654317 --- addons/purchase/purchase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 45d63b15efe..d44bbfa110a 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1017,6 +1017,8 @@ class purchase_order(osv.osv): all(move.invoice_state == 'invoiced' for move in po_line.move_ids if move.state == 'done') and po_line.invoice_lines and all(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines)): is_invoiced.append(po_line.id) + elif po_line.product_id.type == 'service': + is_invoiced.append(po_line.id) else: for po_line in po.order_line: if (po_line.invoice_lines and