From 4a7108a58bebd1e244689f40737cb6b1431ae7a3 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 10 Dec 2022 10:30:51 +0100 Subject: [PATCH] [15.0]account_statement_import - set correct company_id on ir_attachment --- .../wizard/account_statement_import.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/account_statement_import/wizard/account_statement_import.py b/account_statement_import/wizard/account_statement_import.py index 6fc562b4..cf15becd 100644 --- a/account_statement_import/wizard/account_statement_import.py +++ b/account_statement_import/wizard/account_statement_import.py @@ -74,10 +74,13 @@ class AccountStatementImport(models.TransientModel): return action def _prepare_create_attachment(self, result): + # Attach to first bank statement + res_id = result["statement_ids"][0] + st = self.env["account.bank.statement"].browse(res_id) vals = { "name": self.statement_filename, - # Attach to first bank statement - "res_id": result["statement_ids"][0], + "res_id": res_id, + "company_id": st.company_id.id, "res_model": "account.bank.statement", "datas": self.statement_file, }