diff options
Diffstat (limited to 'addons/account/models/partner.py')
| -rw-r--r-- | addons/account/models/partner.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index ef0f030a5ee..e3884d5c975 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -225,7 +225,7 @@ class ResPartner(models.Model): @api.depends_context('force_company') def _credit_debit_get(self): - tables, where_clause, where_params = self.env['account.move.line'].with_context(company_id=self.env.company.id)._query_get() + tables, where_clause, where_params = self.env['account.move.line'].with_context(state='posted', company_id=self.env.company.id)._query_get() where_params = [tuple(self.ids)] + where_params if where_clause: where_clause = 'AND ' + where_clause @@ -266,9 +266,11 @@ class ResPartner(models.Model): SELECT partner.id FROM res_partner partner LEFT JOIN account_move_line aml ON aml.partner_id = partner.id + JOIN account_move move ON move.id = aml.move_id RIGHT JOIN account_account acc ON aml.account_id = acc.id WHERE acc.internal_type = %s AND NOT acc.deprecated AND acc.company_id = %s + AND move.state == 'posted' GROUP BY partner.id HAVING %s * COALESCE(SUM(aml.amount_residual), 0) ''' + operator + ''' %s''', (account_type, self.env.user.company_id.id, sign, operand)) res = self._cr.fetchall() |
