Browse Source
Merge pull request #124 from hbrunn/8.0-camt-abstract-model
backport #110 - CAMT parser as AbstractModel
pull/146/head
Alexis de Lattre
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
11 additions and
5 deletions
-
account_bank_statement_import_camt/__init__.py
-
account_bank_statement_import_camt/models/__init__.py
-
account_bank_statement_import_camt/models/account_bank_statement_import.py
-
account_bank_statement_import_camt/models/parser.py
|
@ -1 +1 @@ |
|
|
from . import account_bank_statement_import |
|
|
|
|
|
|
|
|
from . import models |
|
@ -0,0 +1,5 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# © 2013-2016 Therp BV <http://therp.nl> |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
from . import parser |
|
|
|
|
|
from . import account_bank_statement_import |
|
@ -20,8 +20,6 @@ |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
import logging |
|
|
import logging |
|
|
from openerp import models |
|
|
from openerp import models |
|
|
from .camt import CamtParser as Parser |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__) |
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
@ -32,7 +30,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
|
|
|
|
|
|
def _parse_file(self, cr, uid, data_file, context=None): |
|
|
def _parse_file(self, cr, uid, data_file, context=None): |
|
|
"""Parse a CAMT053 XML file.""" |
|
|
"""Parse a CAMT053 XML file.""" |
|
|
parser = Parser() |
|
|
|
|
|
|
|
|
parser = self.pool['account.bank.statement.import.camt.parser'] |
|
|
try: |
|
|
try: |
|
|
_logger.debug("Try parsing with camt.") |
|
|
_logger.debug("Try parsing with camt.") |
|
|
return parser.parse(data_file) |
|
|
return parser.parse(data_file) |
|
@ -30,8 +30,11 @@ from openerp import _ |
|
|
from openerp.addons.account_bank_statement_import.parserlib import ( |
|
|
from openerp.addons.account_bank_statement_import.parserlib import ( |
|
|
BankStatement) |
|
|
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.""" |
|
|
"""Parser for camt bank statement import files.""" |
|
|
|
|
|
|
|
|
def parse_amount(self, ns, node): |
|
|
def parse_amount(self, ns, node): |