[FIX] account: adapt query for items to reconcile
Changing the bank account on the bank journal led to a traceback (expected singleton on currency_id) when trying to open the reconciliation widget. This is because we are trying to open a blank line as the origin line was linked to the origin Bank account, therefore there is no currency_id. It has been decided to filter the statement line that match the bank account and to adapt the action button. Steps to reproduce: - Create a bank statement line - In Bank journal, change the Bank Account - From Accounting Dashboard, click on "Reconcile X items" or just open the Bank Journal -> Traceback (expected singleton) opw-3085670 closes odoo/odoo#107441 X-original-commit: c566a48c5bc528a140e6f29399ca1fbcede60490 Related: odoo/enterprise#34762 Signed-off-by: Quentin De Paoli <qdp@odoo.com> Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
This commit is contained in:
@@ -280,11 +280,13 @@ class account_journal(models.Model):
|
||||
SELECT COUNT(st_line.id)
|
||||
FROM account_bank_statement_line st_line
|
||||
JOIN account_move st_line_move ON st_line_move.id = st_line.move_id
|
||||
JOIN account_move_line aml ON aml.move_id = st_line_move.id
|
||||
WHERE st_line_move.journal_id IN %s
|
||||
AND NOT st_line.is_reconciled
|
||||
AND st_line_move.to_check IS NOT TRUE
|
||||
AND st_line_move.state = 'posted'
|
||||
''', [tuple(self.ids)])
|
||||
AND aml.account_id = %s
|
||||
''', [tuple(self.ids), self.default_account_id.id])
|
||||
number_to_reconcile = self.env.cr.fetchone()[0]
|
||||
|
||||
to_check_ids = self.to_check_ids()
|
||||
|
||||
Reference in New Issue
Block a user