From 1e2ff2f73a301af3e13210f3c77b9c29958e078a Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 17 Aug 2017 14:29:01 +0200 Subject: [PATCH 1/2] [FIX] make backported commit cherry pickable --- account_bank_statement_import_camt/__init__.py | 2 +- .../{ => models}/account_bank_statement_import.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename account_bank_statement_import_camt/{ => models}/account_bank_statement_import.py (100%) diff --git a/account_bank_statement_import_camt/__init__.py b/account_bank_statement_import_camt/__init__.py index 7dafcd1..0650744 100644 --- a/account_bank_statement_import_camt/__init__.py +++ b/account_bank_statement_import_camt/__init__.py @@ -1 +1 @@ -from . import account_bank_statement_import +from . import models diff --git a/account_bank_statement_import_camt/account_bank_statement_import.py b/account_bank_statement_import_camt/models/account_bank_statement_import.py similarity index 100% rename from account_bank_statement_import_camt/account_bank_statement_import.py rename to account_bank_statement_import_camt/models/account_bank_statement_import.py From b9e8796225bd2b8415b81bafbea70d19f168a744 Mon Sep 17 00:00:00 2001 From: Louis Bettens Date: Fri, 21 Apr 2017 14:31:50 +0200 Subject: [PATCH 2/2] [IMP] camt: allow modules to enhance the parser --- account_bank_statement_import_camt/models/__init__.py | 5 +++++ .../models/account_bank_statement_import.py | 4 +--- .../{camt.py => models/parser.py} | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 account_bank_statement_import_camt/models/__init__.py rename account_bank_statement_import_camt/{camt.py => models/parser.py} (98%) diff --git a/account_bank_statement_import_camt/models/__init__.py b/account_bank_statement_import_camt/models/__init__.py new file mode 100644 index 0000000..0251c8f --- /dev/null +++ b/account_bank_statement_import_camt/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2013-2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import parser +from . import account_bank_statement_import diff --git a/account_bank_statement_import_camt/models/account_bank_statement_import.py b/account_bank_statement_import_camt/models/account_bank_statement_import.py index 8814670..2dd2248 100644 --- a/account_bank_statement_import_camt/models/account_bank_statement_import.py +++ b/account_bank_statement_import_camt/models/account_bank_statement_import.py @@ -20,8 +20,6 @@ ############################################################################## import logging from openerp import models -from .camt import CamtParser as Parser - _logger = logging.getLogger(__name__) @@ -32,7 +30,7 @@ class AccountBankStatementImport(models.TransientModel): def _parse_file(self, cr, uid, data_file, context=None): """Parse a CAMT053 XML file.""" - parser = Parser() + parser = self.pool['account.bank.statement.import.camt.parser'] try: _logger.debug("Try parsing with camt.") return parser.parse(data_file) diff --git a/account_bank_statement_import_camt/camt.py b/account_bank_statement_import_camt/models/parser.py similarity index 98% rename from account_bank_statement_import_camt/camt.py rename to account_bank_statement_import_camt/models/parser.py index 5a6585a..8905186 100644 --- a/account_bank_statement_import_camt/camt.py +++ b/account_bank_statement_import_camt/models/parser.py @@ -30,8 +30,11 @@ from openerp import _ from openerp.addons.account_bank_statement_import.parserlib import ( BankStatement) +from openerp import models -class CamtParser(object): + +class CamtParser(models.AbstractModel): + _name = 'account.bank.statement.import.camt.parser' """Parser for camt bank statement import files.""" def parse_amount(self, ns, node):