mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] account_statement_ofx_import: Fix PEP8
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
'description': """
|
'description': """
|
||||||
Allows to import OFX (Open Financial Exchange) statement files, using
|
Allows to import OFX (Open Financial Exchange) statement files, using
|
||||||
*account_statement_base_import* generic inheritance mechanism to import
|
*account_statement_base_import* generic inheritance mechanism to import
|
||||||
statements.
|
statements.
|
||||||
|
|
||||||
It requires ofxparse library to work.
|
It requires ofxparse library to work.
|
||||||
|
|||||||
@@ -21,10 +21,9 @@
|
|||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.addons.account_statement_base_import.parser import BankStatementImportParser
|
from openerp.addons.account_statement_base_import.parser import \
|
||||||
|
BankStatementImportParser
|
||||||
try:
|
try:
|
||||||
import ofxparse
|
import ofxparse
|
||||||
except:
|
except:
|
||||||
@@ -32,33 +31,25 @@ except:
|
|||||||
|
|
||||||
|
|
||||||
class OfxParser(BankStatementImportParser):
|
class OfxParser(BankStatementImportParser):
|
||||||
|
|
||||||
"""Class for defining parser for OFX file format."""
|
"""Class for defining parser for OFX file format."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parser_for(cls, parser_name):
|
def parser_for(cls, parser_name):
|
||||||
"""
|
"""Used by the new_bank_statement_parser class factory. Return true if
|
||||||
Used by the new_bank_statement_parser class factory. Return true if
|
|
||||||
the providen name is 'ofx_so'.
|
the providen name is 'ofx_so'.
|
||||||
"""
|
"""
|
||||||
return parser_name == 'ofx_so'
|
return parser_name == 'ofx_so'
|
||||||
|
|
||||||
def _custom_format(self, *args, **kwargs):
|
def _custom_format(self, *args, **kwargs):
|
||||||
"""
|
"""No other work on data are needed in this parser."""
|
||||||
No other work on data are needed in this parser.
|
|
||||||
"""
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _pre(self, *args, **kwargs):
|
def _pre(self, *args, **kwargs):
|
||||||
"""
|
"""No pre-treatment needed for this parser."""
|
||||||
No pre-treatment needed for this parser.
|
|
||||||
"""
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _parse(self, *args, **kwargs):
|
def _parse(self, *args, **kwargs):
|
||||||
"""
|
"""Launch the parsing itself."""
|
||||||
Launch the parsing itself.
|
|
||||||
"""
|
|
||||||
ofx_file = tempfile.NamedTemporaryFile()
|
ofx_file = tempfile.NamedTemporaryFile()
|
||||||
ofx_file.seek(0)
|
ofx_file.seek(0)
|
||||||
ofx_file.write(self.filebuffer)
|
ofx_file.write(self.filebuffer)
|
||||||
@@ -77,26 +68,15 @@ class OfxParser(BankStatementImportParser):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _validate(self, *args, **kwargs):
|
def _validate(self, *args, **kwargs):
|
||||||
"""
|
"""Nothing to do here. ofxparse trigger possible format errors."""
|
||||||
Nothing to do here. ofxparse trigger possible format errors.
|
|
||||||
"""
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _post(self, *args, **kwargs):
|
def _post(self, *args, **kwargs):
|
||||||
"""
|
"""Nothing is needed to do after parsing."""
|
||||||
Nothing is needed to do after parsing.
|
|
||||||
"""
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _post(self, *args, **kwargs):
|
|
||||||
"""
|
|
||||||
Nothing to do.
|
|
||||||
"""
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_st_line_vals(self, line, *args, **kwargs):
|
def get_st_line_vals(self, line, *args, **kwargs):
|
||||||
"""
|
"""This method must return a dict of vals that can be passed to create
|
||||||
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
|
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
|
responsibility of every parser to give this dict of vals, so each one
|
||||||
can implement his own way of recording the lines.
|
can implement his own way of recording the lines.
|
||||||
|
|||||||
Reference in New Issue
Block a user