From 424c430fa541edaa839d48332b44178d9c44fb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 Sep 2013 11:21:19 +0200 Subject: [PATCH] Create invoice line for non-line only once issue3292 review1043003 (transplanted from 399d66f4e5262cffe86254af3f43074f2e43418d) --- purchase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/purchase.py b/purchase.py index a974940fd9..4e30c24a20 100644 --- a/purchase.py +++ b/purchase.py @@ -1123,8 +1123,10 @@ class PurchaseLine(ModelSQL, ModelView): invoice_line.type = self.type invoice_line.description = self.description invoice_line.note = self.note + invoice_line.origin = self if self.type != 'line': if (self.purchase.invoice_method == 'order' + and not self.invoice_lines and ((all(l.quantity >= 0 for l in self.purchase.lines if l.type == 'line') and invoice_type == 'in_invoice') @@ -1179,7 +1181,6 @@ class PurchaseLine(ModelSQL, ModelView): if not invoice_line.account: self.raise_user_error('missing_account_expense_property', (invoice_line.purchase.rec_name,)) - invoice_line.origin = self return [invoice_line] @classmethod