[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
This commit is contained in:
Nicolas Martinelli
2016-10-20 13:50:09 +02:00
parent afc2497a48
commit d30dc96750
@@ -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,
}