# ############################################################################## import base64 import time from openerp.osv import osv from openerp.tools.translate import _ from openerp import tools import logging _logger = logging.getLogger(__name__) from openerp.addons.account_bank_statement_import import account_bank_statement_import as coda_ibs coda_ibs.add_file_type(('coda', 'CODA')) class account_bank_statement_import(osv.TransientModel): _inherit = "account.bank.statement.import" def process_coda(self, cr, uid, codafile=None, journal_id=False, context=None): if context is None: context = {} recordlist = unicode(base64.decodestring(codafile), 'windows-1252', 'strict').split('\n')
# -*- coding: utf-8 -*- # noqa: This is a backport from Odoo. OCA has no control over style here. # flake8: noqa import logging import base64 import os import getpass from openerp.osv import osv from openerp.tools.translate import _ _logger = logging.getLogger(__name__) from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs ibs.add_file_type(('ofx', 'OFX')) try: from ofxparse import OfxParser as ofxparser except ImportError: _logger.warning("OFX parser unavailable because the `ofxparse` Python library cannot be found." "It can be downloaded and installed from `https://pypi.python.org/pypi/ofxparse`.") ofxparser = None class account_bank_statement_import(osv.TransientModel): _inherit = 'account.bank.statement.import' def process_ofx(self, cr, uid, data_file, journal_id=False, context=None): """ Import a file in the .OFX format""" if ofxparser is None: raise osv.except_osv(_("Error"), _("OFX parser unavailable because the `ofxparse` Python library cannot be found."
# -*- coding: utf-8 -*- import logging import base64 import os from openerp.osv import osv from openerp.tools.translate import _ _logger = logging.getLogger(__name__) from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs ibs.add_file_type(('ofx', 'OFX')) try: from ofxparse import OfxParser as ofxparser except ImportError: _logger.warning( "OFX parser unavailable because the `ofxparse` Python library cannot be found." "It can be downloaded and installed from `https://pypi.python.org/pypi/ofxparse`." ) ofxparser = None class account_bank_statement_import(osv.TransientModel): _inherit = 'account.bank.statement.import' def process_ofx(self, cr, uid, data_file, journal_id=False, context=None): """ Import a file in the .OFX format""" if ofxparser is None: raise osv.except_osv(
# ############################################################################## import base64 import time from openerp.osv import osv from openerp.tools.translate import _ from openerp import tools import logging _logger = logging.getLogger(__name__) from openerp.addons.account_bank_statement_import import account_bank_statement_import as coda_ibs coda_ibs.add_file_type(('coda', 'CODA')) class account_bank_statement_import(osv.TransientModel): _inherit = "account.bank.statement.import" def process_coda(self, cr, uid, codafile=None, journal_id=False, context=None): if context is None: context = {} recordlist = unicode(base64.decodestring(codafile), 'windows-1252', 'strict').split('\n') statements = [] globalisation_comm = {} for line in recordlist: if not line: pass elif line[0] == '0': #Begin of a new Bank statement
# -*- coding: utf-8 -*- import dateutil.parser import base64 from tempfile import TemporaryFile from openerp.tools.translate import _ from openerp.osv import osv from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs ibs.add_file_type(('qif', 'QIF')) class account_bank_statement_import(osv.TransientModel): _inherit = "account.bank.statement.import" def process_qif(self, cr, uid, data_file, journal_id=False, context=None): """ Import a file in the .QIF format""" try: fileobj = TemporaryFile('wb+') fileobj.write(base64.b64decode(data_file)) fileobj.seek(0) file_data = "" for line in fileobj.readlines(): file_data += line fileobj.close() if '\r' in file_data: data_list = file_data.split('\r') else: data_list = file_data.split('\n') header = data_list[0].strip()
# -*- coding: utf-8 -*- # noqa: This is a backport from Odoo. OCA has no control over style here. # flake8: noqa import dateutil.parser import base64 from tempfile import TemporaryFile from openerp.tools.translate import _ from openerp.osv import osv from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs ibs.add_file_type(('qif', 'QIF')) class account_bank_statement_import(osv.TransientModel): _inherit = "account.bank.statement.import" def process_qif(self, cr, uid, data_file, journal_id=False, context=None): """ Import a file in the .QIF format""" try: fileobj = TemporaryFile('wb+') fileobj.write(base64.b64decode(data_file)) fileobj.seek(0) file_data = "" for line in fileobj.readlines(): file_data += line fileobj.close() if '\r' in file_data: data_list = file_data.split('\r')
# ############################################################################## import base64 import time from openerp.osv import osv from openerp.tools.translate import _ from openerp import tools import logging _logger = logging.getLogger(__name__) from openerp.addons.account_bank_statement_import import account_bank_statement_import as coda_ibs coda_ibs.add_file_type(("coda", "CODA")) class account_bank_statement_import(osv.TransientModel): _inherit = "account.bank.statement.import" def process_coda(self, cr, uid, codafile=None, journal_id=False, context=None): if context is None: context = {} recordlist = unicode(base64.decodestring(codafile), "windows-1252", "strict").split("\n") statements = [] for line in recordlist: if not line: pass elif line[0] == "0": # Begin of a new Bank statement