mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] pep8, pylint, eyeballing
This commit is contained in:
@@ -19,23 +19,16 @@
|
||||
##############################################################################
|
||||
|
||||
from openerp.tools.translate import _
|
||||
import base64
|
||||
import csv
|
||||
import tempfile
|
||||
import datetime
|
||||
from account_statement_base_import.parser.file_parser import FileParser
|
||||
|
||||
try:
|
||||
import xlrd
|
||||
except:
|
||||
raise Exception(_('Please install python lib xlrd'))
|
||||
|
||||
class TransactionIDFileParser(FileParser):
|
||||
"""
|
||||
TransactionID parser that use a define format in csv or xls to import
|
||||
bank statement.
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, parse_name, ftype='csv'):
|
||||
convertion_dict = {
|
||||
'transaction_id': unicode,
|
||||
@@ -46,7 +39,7 @@ class TransactionIDFileParser(FileParser):
|
||||
}
|
||||
# Order of cols does not matter but first row of the file has to be header
|
||||
keys_to_validate = ['transaction_id', 'label', 'date', 'amount', 'commission_amount']
|
||||
super(TransactionIDFileParser,self).__init__(parse_name, keys_to_validate=keys_to_validate, ftype=ftype, convertion_dict=convertion_dict)
|
||||
super(TransactionIDFileParser, self).__init__(parse_name, keys_to_validate=keys_to_validate, ftype=ftype, convertion_dict=convertion_dict)
|
||||
|
||||
@classmethod
|
||||
def parser_for(cls, parser_name):
|
||||
@@ -59,7 +52,7 @@ class TransactionIDFileParser(FileParser):
|
||||
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
|
||||
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
|
||||
@@ -77,12 +70,12 @@ class TransactionIDFileParser(FileParser):
|
||||
for each one.
|
||||
"""
|
||||
return {
|
||||
'name': line.get('label', line.get('ref','/')),
|
||||
'name': line.get('label', line.get('ref', '/')),
|
||||
'date': line.get('date', datetime.datetime.now().date()),
|
||||
'amount': line.get('amount', 0.0),
|
||||
'ref': line.get('transaction_id','/'),
|
||||
'label': line.get('label',''),
|
||||
'transaction_id': line.get('transaction_id','/'),
|
||||
'ref': line.get('transaction_id', '/'),
|
||||
'label': line.get('label', ''),
|
||||
'transaction_id': line.get('transaction_id', '/'),
|
||||
'commission_amount': line.get('commission_amount', 0.0),
|
||||
}
|
||||
|
||||
@@ -93,7 +86,6 @@ class TransactionIDFileParser(FileParser):
|
||||
res = super(TransactionIDFileParser, self)._post(*args, **kwargs)
|
||||
val = 0.0
|
||||
for row in self.result_row_list:
|
||||
val += row.get('commission_amount',0.0)
|
||||
val += row.get('commission_amount', 0.0)
|
||||
self.commission_global_amount = val
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user