summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNans Lefebvre <len@odoo.com>2019-07-01 11:38:45 +0000
committerNans Lefebvre <len@odoo.com>2019-07-01 12:08:09 +0000
commitf401d2f3bab6ec2ba2e41e99bb58d63a6d401d91 (patch)
tree7317f4952b58e29b49d2a1a8551bfcdb5a9bb26e /addons
parent214bbfeb84f4f3f7255449ae121b77f406138ad7 (diff)
[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
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/partner.py4
1 files 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')]