[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 017184331b, which adapted the compute method
to the multi-company setting, as before the two were summing all companies.

opw 2028660
This commit is contained in:
Nans Lefebvre
2019-07-01 12:08:09 +00:00
parent 214bbfeb84
commit f401d2f3ba
+2 -2
View File
@@ -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')]