[FIX] account: context issue when importing statements

The file uploader uses a context key `default_journal_id` to identify the journal to upload to. With commit https://github.com/odoo/enterprise/commit/0d7d1a2994f14b80cd8f3644871f87a472821741, we attempt to reconcile imported transactions immediately. When reconciling, if there is a partner and an account number, the res.partner.bank is created.

Problem:
When creating a partner bank account, the default_journal_id is in the context, and is interpreted as a default value, which causes a stack trace.

Solution:
Explicitly specifiy the journal_id when the partner bank account is created, so there is no invalid value when obtaining defaults.

task-3299109
opw-3291805
opw-3291064
opw-3291024

closes odoo/odoo#120554

X-original-commit: ff4e080d3e006104cf6345d96e56714b0f8be16d
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
This commit is contained in:
Habib (ayh)
2023-05-04 23:30:54 +02:00
parent d0e55f082b
commit d7d02c44c6
@@ -422,6 +422,7 @@ class AccountBankStatementLine(models.Model):
bank_account = self.env['res.partner.bank'].create({
'acc_number': self.account_number,
'partner_id': self.partner_id.id,
'journal_id': None,
})
return bank_account