Code review comment for lp:~camptocamp/account-consolidation/account-consolidation-fix-mono-currency

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> The goal of this function is to create the move line to manage rounding
> difference, transitory difference but when it is call the currency conversion
> has been done upstream and the move we want to adjust is already in "holding"
> currency.

I don't speak about currency conversion.

You have to use `is_zero` on the holding's currency instead of ``.

Here is the method I speak about:

    def is_zero(self, cr, uid, currency, amount):
        """Returns true if ``amount`` is small enough to be treated as
           zero according to ``currency``'s rounding rules.

           Warning: ``is_zero(amount1-amount2)`` is not always equivalent to
           ``compare_amounts(amount1,amount2) == 0``, as the former will round after
           computing the difference, while the latter will round before, giving
           different results for e.g. 0.006 and 0.002 at 2 digits precision.

           :param browse_record currency: currency for which we are rounding
           :param float amount: amount to compare with currency's zero
        return float_is_zero(amount, precision_rounding=currency.rounding)

review: Needs Fixing

« Back to merge proposal