From d30dc9675082374c76eef6698b036c0cc5c33e23 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 18 Oct 2016 17:07:56 +0200 Subject: [PATCH] [FIX] account: aml linked to statement When fetching the journal items linked to a bank statement, the counterpart items are not retrievd since they are not directly linked to the bank statement. It makes the entries look unbalanced. Closes #13673 opw-690231 --- addons/account/models/account_bank_statement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 3daacb8c348..056cf27c445 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -256,6 +256,8 @@ class AccountBankStatement(models.Model): def button_journal_entries(self): context = dict(self._context or {}) context['journal_id'] = self.journal_id.id + aml = self.env['account.move.line'].search([('statement_id', 'in', self.ids)]) + aml |= aml.mapped('move_id').mapped('line_ids') return { 'name': _('Journal Items'), 'view_type': 'form', @@ -263,7 +265,7 @@ class AccountBankStatement(models.Model): 'res_model': 'account.move.line', 'view_id': False, 'type': 'ir.actions.act_window', - 'domain': [('statement_id', 'in', self.ids)], + 'domain': [('id', 'in', aml.ids)], 'context': context, }