Skip to content
Snippets Groups Projects
Commit 89c2e509 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] account: invoiced amount with down payment

- Create a SO of 1000
- Create a down payment of 300, validate
- Create the final invoice

In the partner view, a total of 1600 is displayed as invoiced.

In the case of a down payment, the corresponding invoice line has an
amount with a negative sign. Since the report computes the absolute
value before multiplying by the sign, this information is lost.

The absolute value is not necessary since `price_subtotal_signed`
already includes the correct sign.

opw-741159
parent 3d35aef5
Branches
Tags
No related merge requests found
......@@ -114,7 +114,7 @@ class AccountInvoiceReport(models.Model):
ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id,
ai.partner_bank_id,
SUM ((invoice_type.sign * ail.quantity) / (u.factor * u2.factor)) AS product_qty,
SUM(invoice_type.sign * ABS(ail.price_subtotal_signed)) AS price_total,
SUM(ail.price_subtotal_signed) AS price_total,
SUM(ABS(ail.price_subtotal_signed)) / CASE
WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric
THEN SUM(ail.quantity / u.factor * u2.factor)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment