voucher_brw = self.pool.get('account.voucher').browse(cr, uid, voucher_id, context)
ctx = context.copy()
ctx.update({'date': voucher_brw.date})
+ prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
for line in voucher_brw.line_ids:
#create one move line per voucher line where amount is not 0.0
- if not line.amount:
- #The second part of the condition handle cases were payment/receipt has an amount of 0
++ # AND (second part of the clause) only if the original move line was not having debit = credit = 0 (which is a legal value)
+ if not line.amount and not (line.move_line_id and not float_compare(line.move_line_id.debit, line.move_line_id.credit, precision_rounding=prec) and not float_compare(line.move_line_id.debit, 0.0, precision_rounding=prec)):
continue
# convert the amount set on the voucher line into the currency of the voucher's company
amount = self._convert_amount(cr, uid, line.untax_amount or line.amount, voucher_brw.id, context=ctx)