account_statement_import: Do not overwrite journal active_id

The call to parse_file must not overwrite the active_id value in the context
as this active_id refers to the journal from which the wizard was called.

It was especially wrong because the existing active_model key is still set to
account.journal, with an active_id that was referencing account.statement.import
wizard ID.

If the wizard ID is needed, it can still be found on self, and if this ID
must be propagated through the context, it must use a dedicated key instead
of hijacking the active_id.
This commit is contained in:
Akim Juillerat
2024-05-28 21:14:17 +02:00
parent 05924cd14e
commit 83bd8f71a2

View File

@@ -74,7 +74,7 @@ class AccountStatementImport(models.TransientModel):
return vals
def import_single_file(self, file_data, result):
parsing_data = self.with_context(active_id=self.ids[0])._parse_file(file_data)
parsing_data = self._parse_file(file_data)
if not isinstance(parsing_data, list): # for backward compatibility
parsing_data = [parsing_data]
logger.info(