Don't create payments for account.move.lines with 0.0 as amount to pay

This commit is contained in:
Guillem Barba 2013-12-05 12:25:36 +01:00
parent a063e92b56
commit 7315b92d1b
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from decimal import Decimal
from sql.aggregate import Sum
from sql.conditionals import Case, Coalesce
from sql.functions import Abs
@ -163,8 +164,11 @@ class PayLine(Wizard):
payments = []
for line in lines:
if line.payment_amount == Decimal('0.0'):
continue
payments.append(self.get_payment(line))
payments = Payment.create([p._save_values for p in payments])
if payments:
payments = Payment.create([p._save_values for p in payments])
return action, {
'res_id': [p.id for p in payments],
}