mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[REM] account_statement_ofx_import: Duplicated functionality in OCA/bank-statement-import
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Pedro Manuel Baeza Romero
|
||||
# Copyright 2013 Servicios Tecnológicos Avanzados
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import statement
|
||||
from . import parser
|
||||
@@ -1,49 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Pedro Manuel Baeza Romero
|
||||
# Copyright 2013 Servicios Tecnológicos Avanzados
|
||||
# Financed by AB Internet (http://www.abinternet.co.uk/)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{'name': "Bank statement OFX import",
|
||||
'version': '1.0.1',
|
||||
'author': "Servicios Tecnológicos Avanzados - Pedro M. Baeza,Odoo Community Association (OCA)",
|
||||
'maintainer': 'Pedro M. Baeza',
|
||||
'category': 'Finance',
|
||||
'complexity': 'normal',
|
||||
'depends': [
|
||||
'account_statement_base_import',
|
||||
],
|
||||
'external_dependencies': {
|
||||
'python': ['ofxparse'],
|
||||
},
|
||||
'description': """
|
||||
Allows to import OFX (Open Financial Exchange) statement files, using
|
||||
*account_statement_base_import* generic inheritance mechanism to import
|
||||
statements.
|
||||
|
||||
It requires ofxparse library to work.
|
||||
""",
|
||||
'website': 'http://www.serviciosbaeza.com',
|
||||
'data': [],
|
||||
'test': [],
|
||||
'installable': False,
|
||||
'images': [],
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_statement_ofx_import
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-01-21 12:05+0000\n"
|
||||
"PO-Revision-Date: 2014-01-21 12:05+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: code:addons/account_statement_ofx_import/statement.py:34
|
||||
#, python-format
|
||||
msgid "OFX - Open Financial Exchange"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: code:addons/account_statement_ofx_import/parser/ofx_parser.py:29
|
||||
#, python-format
|
||||
msgid "Please install python lib ofxparse"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: model:ir.model,name:account_statement_ofx_import.model_account_statement_profile
|
||||
msgid "Statement Profile"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Spanish translation for banking-addons
|
||||
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
|
||||
# This file is distributed under the same license as the banking-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: banking-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2014-01-21 12:05+0000\n"
|
||||
"PO-Revision-Date: 2014-06-05 22:40+0000\n"
|
||||
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n"
|
||||
"Language-Team: Spanish <es@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2014-06-06 06:36+0000\n"
|
||||
"X-Generator: Launchpad (build 17031)\n"
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: code:addons/account_statement_ofx_import/statement.py:34
|
||||
#, python-format
|
||||
msgid "OFX - Open Financial Exchange"
|
||||
msgstr "OFX - Open Financial Exchange"
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: code:addons/account_statement_ofx_import/parser/ofx_parser.py:29
|
||||
#, python-format
|
||||
msgid "Please install python lib ofxparse"
|
||||
msgstr "Instale por favor la librería ofxparse"
|
||||
|
||||
#. module: account_statement_ofx_import
|
||||
#: model:ir.model,name:account_statement_ofx_import.model_account_statement_profile
|
||||
msgid "Statement Profile"
|
||||
msgstr "Perfil de extracto"
|
||||
@@ -1,21 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Pedro Manuel Baeza Romero
|
||||
# Copyright 2013 Servicios Tecnológicos Avanzados
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import ofx_parser
|
||||
@@ -1,94 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Pedro Manuel Baeza Romero
|
||||
# Copyright 2013 Servicios Tecnológicos Avanzados
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import tempfile
|
||||
import datetime
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.account_statement_base_import.parser import \
|
||||
BankStatementImportParser
|
||||
try:
|
||||
import ofxparse
|
||||
except:
|
||||
raise Exception(_('Please install python lib ofxparse'))
|
||||
|
||||
|
||||
class OfxParser(BankStatementImportParser):
|
||||
"""Class for defining parser for OFX file format."""
|
||||
|
||||
@classmethod
|
||||
def parser_for(cls, parser_name):
|
||||
"""Used by the new_bank_statement_parser class factory. Return true if
|
||||
the providen name is 'ofx_so'.
|
||||
"""
|
||||
return parser_name == 'ofx_so'
|
||||
|
||||
def _custom_format(self, *args, **kwargs):
|
||||
"""No other work on data are needed in this parser."""
|
||||
return True
|
||||
|
||||
def _pre(self, *args, **kwargs):
|
||||
"""No pre-treatment needed for this parser."""
|
||||
return True
|
||||
|
||||
def _parse(self, *args, **kwargs):
|
||||
"""Launch the parsing itself."""
|
||||
ofx_file = tempfile.NamedTemporaryFile()
|
||||
ofx_file.seek(0)
|
||||
ofx_file.write(self.filebuffer)
|
||||
ofx_file.flush()
|
||||
ofx = ofxparse.OfxParser.parse(file(ofx_file.name))
|
||||
ofx_file.close()
|
||||
res = []
|
||||
for transaction in ofx.account.statement.transactions:
|
||||
res.append({
|
||||
'date': transaction.date,
|
||||
'amount': transaction.amount,
|
||||
'ref': transaction.type,
|
||||
'label': transaction.payee,
|
||||
})
|
||||
self.result_row_list = res
|
||||
return True
|
||||
|
||||
def _validate(self, *args, **kwargs):
|
||||
"""Nothing to do here. ofxparse trigger possible format errors."""
|
||||
return True
|
||||
|
||||
def _post(self, *args, **kwargs):
|
||||
"""Nothing is needed to do after parsing."""
|
||||
return True
|
||||
|
||||
def get_st_line_vals(self, line, *args, **kwargs):
|
||||
"""This method must return a dict of vals that can be passed to create
|
||||
method of statement line in order to record it. It is the
|
||||
responsibility of every parser to give this dict of vals, so each one
|
||||
can implement his own way of recording the lines.
|
||||
:param: line: a dict of vals that represent a line of
|
||||
result_row_list
|
||||
:return: dict of values to give to the create method of statement
|
||||
line
|
||||
"""
|
||||
return {
|
||||
'name': line.get('label', line.get('ref', '/')),
|
||||
'date': line.get('date', datetime.datetime.now().date()),
|
||||
'amount': line.get('amount', 0.0),
|
||||
'ref': line.get('ref', '/'),
|
||||
'label': line.get('label', ''),
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Pedro Manuel Baeza Romero
|
||||
# Copyright 2013 Servicios Tecnológicos Avanzados
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import orm
|
||||
|
||||
|
||||
class AccountStatementProfil(orm.Model):
|
||||
_inherit = "account.statement.profile"
|
||||
|
||||
def _get_import_type_selection(self, cr, uid, context=None):
|
||||
"""Inherited from parent to add parser."""
|
||||
selection = super(AccountStatementProfil, self
|
||||
)._get_import_type_selection(cr, uid,
|
||||
context=context)
|
||||
selection.append(('ofx_so', _('OFX - Open Financial Exchange')))
|
||||
return selection
|
||||
Reference in New Issue
Block a user