From 99703583d4818dd5ec91386d3ed561ca9c1ebd52 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 10 Oct 2017 10:24:31 +0200 Subject: [PATCH] [FIX] account: invoiced amount - Create 2 companies: A is parent of B. - Demo is in Company A - Create 2 invoices for a partner: one in A, one in B (100 each) - Validate the invoices Connected as Demo, the 'Invoiced' amount on the partner form view (stat button) is 100, while clicking on it shows both invoices (total of 200). There is no need to manually add the company in the `where` clause since the `_apply_ir_rules` will take care of adding the appropriate multi-company rules. opw-772479 --- addons/account/models/partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 8e18962ab00..eb423456436 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -306,7 +306,7 @@ class ResPartner(models.Model): # generate where clause to include multicompany rules where_query = account_invoice_report._where_calc([ - ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('company_id', '=', self.env.user.company_id.id), + ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('type', 'in', ('out_invoice', 'out_refund')) ]) account_invoice_report._apply_ir_rules(where_query, 'read')