odoo/addons
Denis Ledoux 9fe040e592 [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
2015-02-11 13:10:54 +01:00
..
account [FIX] account: invoice analysis residual amount 2015-02-11 13:10:54 +01:00
account_accountant [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_analytic_analysis [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_analytic_default Launchpad automatic translations update. 2014-03-28 06:44:40 +00:00
account_analytic_plans [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_anglo_saxon [FIX] account_anglo_saxon: price difference, discount and taxes 2014-10-03 12:19:01 +02:00
account_asset [FIX] account_asset: using attrs to hide method_* fields 2015-01-20 12:17:45 +01:00
account_bank_statement_extensions [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_budget [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_cancel [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_chart Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
account_check_writing [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_followup [FIX] account_followup: formatted user language date in followup text 2015-02-10 15:26:57 +01:00
account_payment [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_report_company [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_sequence [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
account_test [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
account_voucher [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
analytic [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
analytic_contract_hr_expense [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
analytic_user_function [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
anonymization [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
association [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
audittrail [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
auth_crypt [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
auth_ldap [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
auth_oauth [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
auth_oauth_signup Launchpad automatic translations update. 2014-02-06 06:25:10 +00:00
auth_openid [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
auth_signup [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
base_action_rule [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
base_calendar [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
base_gengo [FIX] security: remove read access on company critical fields 2014-08-26 15:35:47 +02:00
base_iban Launchpad automatic translations update. 2014-04-02 06:44:59 +00:00
base_import [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
base_report_designer Launchpad automatic translations update. 2014-02-06 06:25:10 +00:00
base_setup Launchpad automatic translations update. 2014-05-04 06:27:21 +00:00
base_status [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
base_vat [FIX] base_vat: vat check for EU TIN. 2015-02-02 16:47:07 +01:00
board [IMP] *: one Makefile to rules them all. 2014-11-05 19:30:28 +01:00
claim_from_delivery [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
contacts [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
crm [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
crm_claim [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
crm_helpdesk [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
crm_partner_assign [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
crm_profiling Launchpad automatic translations update. 2014-04-02 06:44:59 +00:00
crm_todo [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
decimal_precision [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
delivery [FIX] delivery: reset delivery info on duplicate/backorder 2015-01-14 17:44:37 +01:00
document [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
document_ftp Launchpad automatic translations update. 2014-03-28 06:44:40 +00:00
document_page [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
document_webdav [FIX] 500 error on connection when using PyWebDAV 0.9.4 2014-04-11 15:42:03 +02:00
edi Allow EDI fields to be propagated if they have _fnct_inv 2015-01-16 17:49:58 +01:00
email_template [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
event [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
event_moodle [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
event_sale [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
fetchmail [IMP] fetchmail: process pop messages in subsets 2015-02-09 13:21:06 +01:00
fleet [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
google_base_account [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
google_docs [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_attendance [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_contract [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
hr_evaluation [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_expense [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_holidays [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_payroll [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_payroll_account [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_recruitment [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_timesheet Launchpad automatic translations update. 2014-03-20 06:19:44 +00:00
hr_timesheet_invoice [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
hr_timesheet_sheet [FIX] hr_timesheet_sheet: default product in analytic lines 2015-02-10 11:54:55 +01:00
idea [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
knowledge Launchpad automatic translations update. 2014-04-02 06:44:59 +00:00
l10n_ar [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_at [IMP] Improved data for account chart template 2013-09-06 17:35:36 +05:30
l10n_be [FIX] l10n_be: spelling error in financial reports 2014-08-06 16:59:34 +02:00
l10n_be_coda [FIX] l10n_be_coda: match counterparty account number with iban format 2015-01-21 12:00:29 +01:00
l10n_be_hr_payroll [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_be_hr_payroll_account
l10n_be_invoice_bba [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_bo [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_br [FIX] l10n_br: remove reference to old base.group_extended group 2014-11-26 11:33:04 +01:00
l10n_ca Launchpad automatic translations update. 2013-11-27 05:39:57 +00:00
l10n_ch [FIX] account,account_followup,l10n_{ch,es,pt,us,ve}: correct or remove wrong fields in <record> creation 2013-10-31 19:43:21 +01:00
l10n_cl Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_cn Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_co [IMP] Improved data for account chart template 2013-09-06 17:35:36 +05:30
l10n_cr Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_de [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
l10n_ec Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_es Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_et
l10n_fr [RESTORE] Restore *.sxw files, skipped during bzr-to-git conversion to discard older binary blobs 2014-05-22 14:07:15 +02:00
l10n_fr_hr_payroll [FIX] l10n_fr_hr_payroll: bad copy-paste in 69c1333 2014-10-20 10:48:19 +02:00
l10n_fr_rib [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
l10n_gr Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_gt Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_hn Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_hr [IMP] Improved code as per coding convention 2013-09-06 18:25:57 +05:30
l10n_in Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_in_hr_payroll [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_it Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_lu [ADD] l10n_lu: abbreviated financial reports 2014-10-06 16:30:10 +02:00
l10n_ma [FIX] l10n_ma: proper chart of account name 2014-08-29 15:46:36 +02:00
l10n_multilang [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
l10n_mx [FIX] l10n_mx: account.chart.template does not have any property_stock_account_{in,out}put_categ fields 2013-11-09 00:11:30 +01:00
l10n_nl Launchpad automatic translations update. 2013-11-27 05:39:57 +00:00
l10n_pa [IMP] Improved data for account chart template 2013-09-06 17:35:36 +05:30
l10n_pe Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_pl [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_pt [FIX] account,account_followup,l10n_{ch,es,pt,us,ve}: correct or remove wrong fields in <record> creation 2013-10-31 19:43:21 +01:00
l10n_ro [FIX] l10n_ro: changed module author as requested in issue 621105 2014-12-23 13:42:10 +01:00
l10n_si
l10n_syscohada [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_th Launchpad automatic translations update. 2013-11-21 06:38:38 +00:00
l10n_tr [IMP]Improved currency as per country data file 2013-09-09 10:50:54 +05:30
l10n_uk Launchpad automatic translations update. 2013-11-27 05:39:57 +00:00
l10n_us [FIX] account,account_followup,l10n_{ch,es,pt,us,ve}: correct or remove wrong fields in <record> creation 2013-10-31 19:43:21 +01:00
l10n_uy [IMP]Improved currency as per country data file 2013-09-09 10:50:54 +05:30
l10n_ve [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
l10n_vn [IMP] Improved data for account chart template 2013-09-06 17:35:36 +05:30
lunch [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
mail [IMP] mail: prevent leaving when composing a message 2015-01-15 19:04:05 +01:00
marketing [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
marketing_campaign [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
marketing_campaign_crm_demo [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
membership Launchpad automatic translations update. 2014-04-22 08:24:59 +00:00
mrp [FIX] mrp: production traceability 2015-01-15 12:04:23 +01:00
mrp_byproduct [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
mrp_jit Launchpad automatic translations update. 2014-02-17 06:03:28 +00:00
mrp_operations [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
mrp_repair [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
multi_company [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
note [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
note_pad [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
pad [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
pad_project [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
plugin [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
plugin_outlook [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
plugin_thunderbird [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
point_of_sale [REF] remove useless quotes 2015-02-03 18:14:55 +01:00
portal [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_anonymous Launchpad automatic translations update. 2014-02-06 06:25:10 +00:00
portal_claim [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_crm [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_event [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
portal_hr_employees Launchpad automatic translations update. 2014-03-04 08:27:04 +00:00
portal_project [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_project_issue [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_project_long_term
portal_sale [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
portal_stock
process Launchpad automatic translations update. 2014-04-02 06:44:59 +00:00
procurement [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
product [FIX] product: moved pricelist_item ACL from stock to product 2015-02-04 16:17:36 +01:00
product_expiry [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
product_manufacturer [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
product_margin Launchpad automatic translations update. 2014-05-18 05:53:48 +00:00
product_visible_discount [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
project [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
project_gtd [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
project_issue [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
project_issue_sheet [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
project_long_term [FIX] project_long_term: avoid bad duplication of phases 2014-07-30 16:12:22 +02:00
project_mrp [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
project_timesheet [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
purchase [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
purchase_analytic_plans [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
purchase_double_validation [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
purchase_requisition [FIX] purchase_requisition: restrict selection to purchasable products 2015-01-08 11:43:28 +01:00
report_intrastat [RESTORE] Restore *.sxw files, skipped during bzr-to-git conversion to discard older binary blobs 2014-05-22 14:07:15 +02:00
report_webkit [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
resource [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_analytic_plans Launchpad automatic translations update. 2014-05-18 05:53:48 +00:00
sale_crm [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_journal [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_margin [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_mrp [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_order_dates [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
sale_stock [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
share [FIX] share: action params in url is action, not action_id 2015-02-06 12:59:07 +01:00
stock [FIX] stock: obvious distraction error of previous rev. 8ff7d299f5 2015-02-05 15:09:06 +01:00
stock_invoice_directly Launchpad automatic translations update. 2014-04-02 06:44:59 +00:00
stock_location Launchpad automatic translations update. 2014-05-18 05:53:48 +00:00
stock_no_autopicking Launchpad automatic translations update. 2014-02-13 06:47:42 +00:00
subscription [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
survey [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
warning [FIX] warning: domain was lost in onchange result 2015-01-08 17:48:01 +01:00
web [FIX] web: editable lists and read only fields bug 2015-02-11 12:46:13 +01:00
web_analytics
web_api Launchpad automatic translations update. 2014-05-11 07:08:41 +00:00
web_calendar [FIX] web_calendar: reset dataset index if search result empty 2014-09-24 13:07:59 +02:00
web_diagram [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
web_gantt [FIX] web_gantt: duration in business days if delay not set 2014-12-16 10:49:18 +01:00
web_graph [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
web_hello [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
web_kanban [FIX] web,web_kanban: correct radial-gradient usage 2014-11-05 20:57:59 +01:00
web_linkedin [I18N] Update 7.0 translations with latest changes on Launchpad 2014-08-14 03:38:58 +02:00
web_shortcuts Launchpad automatic translations update. 2014-02-06 06:25:10 +00:00
web_tests Launchpad automatic translations update. 2014-05-11 07:08:41 +00:00
web_tests_demo [FIX] web_test_demo: make test model a TransientModel. This avoid a warning about the lack of access rules 2013-11-08 22:42:55 +01:00
web_view_editor [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00