Skip to content

Commit

Permalink
[FIX] use 'float_is_zero' function to compare float to 0:wq
Browse files Browse the repository at this point in the history
  • Loading branch information
damdam-s committed Dec 16, 2015
1 parent 4b249bf commit 852a6d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sale_payment_method/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import logging
from openerp import api, models, fields, exceptions, _
import openerp.addons.decimal_precision as dp
from openerp.tools import float_is_zero

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -103,8 +104,9 @@ def automatic_payment(self, amount=None):
amounts = [(date, amount)]

# reversed is cosmetic, compute returns terms in the 'wrong' order
precision = self.env['decimal.precision'].precision_get('Account')
for date, amount in reversed(amounts):
if amount:
if float_is_zero(amount, precision_digits=precision):
self._add_payment(journal, amount, date)
return True

Expand Down

0 comments on commit 852a6d3

Please sign in to comment.