[FIX] wrong sql calculation on credit and debit value
https://github.com/OCA/account-financial-reporting/issues/443pull/477/head
parent
9bd457e8ff
commit
077f8b2b9e
|
@ -48,12 +48,12 @@ class CustomerOutstandingStatement(models.AbstractModel):
|
|||
SELECT m.name as move_id, l.partner_id, l.date, l.name,
|
||||
l.ref, l.blocked, l.currency_id, l.company_id,
|
||||
CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
|
||||
THEN sum(l.amount_currency)
|
||||
ELSE sum(l.debit)
|
||||
THEN avg(l.amount_currency)
|
||||
ELSE avg(l.debit)
|
||||
END as debit,
|
||||
CASE WHEN (l.currency_id is not null AND l.amount_currency < 0.0)
|
||||
THEN sum(l.amount_currency * (-1))
|
||||
ELSE sum(l.credit)
|
||||
THEN avg(l.amount_currency * (-1))
|
||||
ELSE avg(l.credit)
|
||||
END as credit,
|
||||
CASE WHEN l.balance > 0.0
|
||||
THEN l.balance - sum(coalesce(pd.amount, 0.0))
|
||||
|
|
Loading…
Reference in New Issue