From 4ac89db5db2a903fdb033470db93c011d3b87763 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Fri, 8 Mar 2019 15:40:45 +0100 Subject: [PATCH] improved support empty statements and oca camt parser --- account_ebics/__manifest__.py | 4 +- account_ebics/models/ebics_config.py | 4 +- account_ebics/models/ebics_file.py | 9 +-- .../models/fintech_ebics_register.py | 4 +- account_ebics/views/ebics_file.xml | 1 + account_ebics/wizard/__init__.py | 1 + .../wizard/account_bank_statement_import.py | 62 +++++++++++++++++++ .../wizard/ebics_change_passphrase.py | 2 +- account_ebics/wizard/ebics_xfer.py | 8 +-- 9 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 account_ebics/wizard/account_bank_statement_import.py diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index eacfa80..063d9ac 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2009-2018 Noviat. +# Copyright 2009-2019 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'EBICS banking protocol', - 'version': '11.0.1.5.0', + 'version': '11.0.1.6.0', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index e515826..aef2570 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -1,4 +1,4 @@ -# Copyright 2009-2018 Noviat. +# Copyright 2009-2019 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). """ @@ -288,7 +288,7 @@ class EbicsConfig(models.Model): user = EbicsUser( keyring=keyring, partnerid=self.ebics_partner, userid=self.ebics_user) - except: + except Exception: exctype, value = exc_info()[:2] error = _("EBICS Initialisation Error:") error += '\n' + str(exctype) + '\n' + str(value) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index bc96f33..a2db783 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -1,4 +1,4 @@ -# Copyright 2009-2018 Noviat. +# Copyright 2009-2019 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging @@ -136,7 +136,7 @@ class EbicsFile(models.Model): def _check_import_module(self, module): mod = self.env['ir.module.module'].search( - [('name', '=', module), + [('name', '=like', module), ('state', '=', 'installed')]) if not mod: raise UserError(_( @@ -207,14 +207,15 @@ class EbicsFile(models.Model): @staticmethod def _process_camt053(self): - import_module = 'account_bank_statement_import_camt' + import_module = 'account_bank_statement_import_camt%' self._check_import_module(import_module) wiz_model = 'account.bank.statement.import' wiz_vals = { 'data_file': self.data, 'filename': self.name, } - wiz = self.env[wiz_model].create(wiz_vals) + ctx = dict(self.env.context, active_model='ebics.file') + wiz = self.env[wiz_model].with_context(ctx).create(wiz_vals) res = wiz.import_file() if res.get('res_model') \ == 'account.bank.statement.import.journal.creation': diff --git a/account_ebics/models/fintech_ebics_register.py b/account_ebics/models/fintech_ebics_register.py index 8e63884..c2c2dc6 100644 --- a/account_ebics/models/fintech_ebics_register.py +++ b/account_ebics/models/fintech_ebics_register.py @@ -1,4 +1,4 @@ -# Copyright 2009-2018 Noviat. +# Copyright 2009-2019 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging @@ -32,7 +32,7 @@ except RuntimeError as e: else: _logger.error(e.message) fintech.register() -except: +except Exception: msg = "fintech.register error" tb = ''.join(format_exception(*exc_info())) msg += '\n%s' % tb diff --git a/account_ebics/views/ebics_file.xml b/account_ebics/views/ebics_file.xml index 9888f9a..5cb8f4f 100644 --- a/account_ebics/views/ebics_file.xml +++ b/account_ebics/views/ebics_file.xml @@ -64,6 +64,7 @@ type="object" groups="account.group_account_manager" help="Process the EBICS File"/> +