[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
This commit is contained in:
Nicolas Martinelli 2015-11-17 13:40:37 +01:00
parent c9fce1a404
commit f18399f721
1 changed files with 2 additions and 0 deletions

View File

@ -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