[15.0]account_statement_import - set correct company_id on ir_attachment

This commit is contained in:
Luc De Meyer
2022-12-10 10:30:51 +01:00
parent c6b4a175cf
commit 4a7108a58b

View File

@@ -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,
}