diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-02-11 13:10:54 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-02-11 13:10:54 +0100 |
| commit | 9fe040e59237ebdacd4dd3c299a3e79428354651 (patch) | |
| tree | 7361563a7137d83f05117116933a22ee4d23a2e5 /addons/web/static/src/js/openerpframework.js | |
| parent | 2d524c947cc6ef51e1c2a40dd69a518c9586afc2 (diff) | |
[FIX] account: invoice analysis residual amount
When having an invoice with multiple lines having the same
product_id and account_id, the residual amount was wrong.
This is due to the fact the residual amount of each line
was computed on the residual amount of the invoice divided
by the number of lines of the invoice, and the fact the main
select of the sql view was grouped by product_id, account_id.
So, for an invoice defined as
Product Account Total
A 1 10
A 1 10
B 1 10
The invoice analysis, grouped by product, account, computed
Product Account Total Residual
A 1 20 10
B 1 10 10
The residual amount '10' of the first line being
30 (the residual amount of the invoice)
divided by 3 (the number of lines in the invoice)
The residual amount of the invoice should actually be divided by
the number of lines in the invoice * the count
of occurences in the group by clause
So, in this case, (30 / 3) * 2 = 20
Replacing the big jointure by
SELECT count(*) FROM account_invoice_line l where invoice_id = ai.id
to get the number of lines in the invoice
is just an optimization for performances
opw-621672
Diffstat (limited to 'addons/web/static/src/js/openerpframework.js')
0 files changed, 0 insertions, 0 deletions
