Comment 0 for bug 310569

Revision history for this message
Dukai Gábor (gdukai) wrote :

Hi!
Trunk version.
If in a financial account there are only credit or only debit entries, the balance is computed incorrectly as zero.
This is because some null value checking is missing in the sql query.

In account.account.__compute()
mapping has
'balance': "COALESCE(SUM(l.debit) - SUM(l.credit), 0) as balance ",
at this moment but it should be
'balance': "COALESCE(COALESCE(SUM(l.debit), 0) - COALESCE(SUM(l.credit), 0), 0) as balance ",