[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) <len@odoo.com>
This commit is contained in:
wan
2019-07-01 12:09:01 +00:00
committed by Nans Lefebvre
parent f401d2f3ba
commit 5fef17540c
+1 -1
View File
@@ -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