Manage invoice line creation the same way as stock move

As the invoice and shipment are both managed in the process method. So it sum
all the quantity invoiced (even the canceled) with the exception of the one
already recreated.

review350001
(transplanted from 06a567499842fe1401458ca36b1e62a7d9e796aa)
This commit is contained in:
Cédric Krier committed 2012-05-05 09:23:50 +02:00
1 parent cb49225da2
commit f9f7c2dacc
1 file changed
+3 -8
+3 -8
View File
@@ -1251,17 +1251,12 @@ class PurchaseLine(ModelSQL, ModelView):
quantity += uom_obj.compute_qty(move.uom, move.quantity,
line.unit)
if line.purchase.invoices_ignored:
ignored_ids = set(
l.id for i in line.purchase.invoices_ignored for l in i.lines)
else:
ignored_ids = ()
skip_ids = set(l.id for i in line.purchase.invoices_recreated
for l in i.lines)
for invoice_line in line.invoice_lines:
if invoice_line.type != 'line':
continue
if ((invoice_line.invoice and
invoice_line.invoice.state != 'cancel') or
invoice_line.id in ignored_ids):
if invoice_line.id not in skip_ids:
quantity -= uom_obj.compute_qty(invoice_line.unit,
invoice_line.quantity, line.unit)
res['quantity'] = quantity