From 5fef17540ce650fe2e3e9e74537753149e81e62b 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 closes odoo/odoo#34486 Signed-off-by: Nans Lefebvre (len) --- 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 a4cd4d30363..1b6e1474b35 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -205,7 +205,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