Create invoice line for non-line only once

issue3292
review1043003
This commit is contained in:
Cédric Krier committed 2013-09-02 11:21:19 +02:00
1 parent 97d8890b7f
commit 01cf49cf1d
1 file changed
+2 -1
+2 -1
View File
@@ -1133,8 +1133,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')
@@ -1190,7 +1192,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