From 22e94476b2bca47e12ac36db7a006912aee3dece Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 1 Dec 2017 19:26:53 +0100 Subject: [PATCH] account_bank_statement_import_save_file: Fix filename --- .../models/account_bank_statement_import.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/account_bank_statement_import_save_file/models/account_bank_statement_import.py b/account_bank_statement_import_save_file/models/account_bank_statement_import.py index c61fd65..e5e216a 100644 --- a/account_bank_statement_import_save_file/models/account_bank_statement_import.py +++ b/account_bank_statement_import_save_file/models/account_bank_statement_import.py @@ -20,19 +20,21 @@ class AccountBankStatementImport(models.TransientModel): self.env['account.bank.statement'].browse(statement_ids).write({ 'import_file': self.env['ir.attachment'].create( self._create_import_file_attachment_data( - data_file, statement_ids[0], notifications)).id, + data_file, statement_ids[0], notifications, + self.filename)).id, }) return action @api.model def _create_import_file_attachment_data(self, data_file, statement_id, - notifications): + notifications, filename=None): return { - 'name': '', + 'name': filename or '', 'res_model': 'account.bank.statement', 'res_id': statement_id, 'type': 'binary', 'datas': base64.b64encode(data_file), + 'datas_fname': filename or '', 'description': '\n'.join( '%(type)s: %(message)s' % notification for notification in notifications) or False,