[17.0][ADD] account_statement_import_file: add file to statement's field attachment_ids

This commit is contained in:
manu
2024-05-13 11:48:45 +02:00
parent 56fbbeefd1
commit db8980dabe

View File

@@ -39,7 +39,12 @@ class AccountStatementImport(models.TransientModel):
"only contains already imported transactions."
)
)
self.env["ir.attachment"].create(self._prepare_create_attachment(result))
attachment = self.env["ir.attachment"].create(
self._prepare_create_attachment(result)
)
for statement_id in result["statement_ids"]:
statement = self.env["account.bank.statement"].browse(statement_id)
statement.write({"attachment_ids": [(4, attachment.id)]})
return result
def import_file_button(self):