From 017184331bf01b9fec89049fbc48ac0ebe44d97f Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 23 Jan 2019 09:15:17 +0000 Subject: [PATCH] [FIX] account: get credit and debit regarding to company Detected with OPW 1920765 Reproduce : set multi-companies, install accounting. The due amount for all companies is the sum of the due amount for every single company Cause : the context for company_id is not set in account.move.line:_query_get Solution : set it in res.partner:_credit_debit_get in case _query_get is used elsewhere closes odoo/odoo#30463 --- 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 80b28be3887..be10b0bab1a 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -204,7 +204,7 @@ class ResPartner(models.Model): @api.multi def _credit_debit_get(self): - tables, where_clause, where_params = self.env['account.move.line']._query_get() + tables, where_clause, where_params = self.env['account.move.line'].with_context(company_id=self.env.user.company_id.id)._query_get() where_params = [tuple(self.ids)] + where_params if where_clause: where_clause = 'AND ' + where_clause