From f401d2f3bab6ec2ba2e41e99bb58d63a6d401d91 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Mon, 1 Jul 2019 11:38:45 +0000 Subject: [PATCH] [FIX] account: restrict asset difference search to current company Let contacts be shared in a multi-company setting. Make a filter on 'Total receivable', e.g. greater than 0. All contacts that correspond to this clause are show, even if their Total receivable is nonzero in another company. It follows that a partner can be shown by the filter with a value 0. The inconsistency was created by 017184331bf, which adapted the compute method to the multi-company setting, as before the two were summing all companies. opw 2028660 --- addons/account/models/partner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 428ada05f43..a4cd4d30363 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -241,9 +241,9 @@ class ResPartner(models.Model): LEFT JOIN account_move_line aml ON aml.partner_id = partner.id RIGHT JOIN account_account acc ON aml.account_id = acc.id WHERE acc.internal_type = %s - AND NOT acc.deprecated + AND NOT acc.deprecated AND acc.company_id = %s GROUP BY partner.id - HAVING %s * COALESCE(SUM(aml.amount_residual), 0) ''' + operator + ''' %s''', (account_type, sign, operand)) + HAVING %s * COALESCE(SUM(aml.amount_residual), 0) ''' + operator + ''' %s''', (account_type, self.env.user.company_id.id, sign, operand)) res = self._cr.fetchall() if not res: return [('id', '=', '0')]