diff --git a/customer_outstanding_statement/report/customer_outstanding_statement.py b/customer_outstanding_statement/report/customer_outstanding_statement.py index cc6452ef..1caae334 100644 --- a/customer_outstanding_statement/report/customer_outstanding_statement.py +++ b/customer_outstanding_statement/report/customer_outstanding_statement.py @@ -52,12 +52,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))