• Jérome Perrin's avatar
    accounting: round in grouping when no section currency is set · 3e5ca320
    Jérome Perrin authored
    Grouping feature checks that the sum of all selected lines == 0, which
    is often not the case as the values are float. For that, our approach
    is to round the values with the precision of the accounting currency,
    since these precisions are usually small (typically 0, 2 or 3), we
    don't have problems with rounding. Using the section currency is not
    just a workaround for rounding, it's also correct because we don't
    consider more precise amounts in accounting transaction lines.
    
    The problem with this approach was for the case where no accounting
    currency is set on the section organisation, in that case we did not
    round and this sometimes led to "grouping is impossible" errors that
    are hard to find for users. At this level it's better to use a default
    rounding precision that would make it possible to use the grouping
    feature even when section currency is not set.
    3e5ca320
test.erp5.testAccounting.py 294 KB