From f9f7c2daccd5dce0ccbf5305a8f77793b037d593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 May 2012 09:23:50 +0200 Subject: [PATCH] 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) --- purchase.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/purchase.py b/purchase.py index b1bec40986..06ab3dab5d 100644 --- a/purchase.py +++ b/purchase.py @@ -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