Create invoice line for non-line only once

issue3292
review1043003
(transplanted from 399d66f4e5262cffe86254af3f43074f2e43418d)
This commit is contained in:
Cédric Krier committed 2013-09-02 11:21:19 +02:00
1 parent 337fee9138
commit 424c430fa5
1 file changed
+2 -1
+2 -1
View File
@@ -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