mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] account_statement_transactionid_import: Fix PEP8
This commit is contained in:
@@ -19,42 +19,40 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{'name': "Bank statement transactionID import",
|
||||
'version': '1.0',
|
||||
'author': 'Camptocamp',
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Finance',
|
||||
'complexity': 'normal',
|
||||
'depends': [
|
||||
'account_statement_base_import',
|
||||
'account_statement_transactionid_completion'
|
||||
],
|
||||
'description': """
|
||||
{
|
||||
'name': "Bank statement transactionID import",
|
||||
'version': '1.0',
|
||||
'author': 'Camptocamp',
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Finance',
|
||||
'complexity': 'normal',
|
||||
'depends': [
|
||||
'account_statement_base_import',
|
||||
'account_statement_transactionid_completion'
|
||||
],
|
||||
'description': """
|
||||
This module brings generic methods and fields on bank statement to deal with
|
||||
the importation of different bank and offices that uses transactionID.
|
||||
|
||||
This module allows you to import your bank transactions with a standard .csv or .xls file
|
||||
(you'll find samples in the 'data' folder). It respects the chosen profile
|
||||
(model provided by the account_statement_ext module) to generate the entries.
|
||||
This module allows you to import your bank transactions with a standard .csv
|
||||
or .xls file (you'll find samples in the 'data' folder). It respects the chosen
|
||||
profile (model provided by the account_statement_ext module) to generate the
|
||||
entries.
|
||||
|
||||
This module can handle a commission taken by the payment office and has the following format:
|
||||
This module can handle a commission taken by the payment office and has the
|
||||
following format:
|
||||
|
||||
* transaction_id: the transaction ID given by the bank/office. It is used as reference
|
||||
in the generated entries and is useful for reconciliation process
|
||||
* date: date of the payment
|
||||
* amount: amount paid in the currency of the journal used in the importation profile
|
||||
* transaction_id: the transaction ID given by the bank/office. It is used as
|
||||
reference in the generated entries and is useful for reconciliation process
|
||||
* date: date of the payment
|
||||
* amount: amount paid in the currency of the journal used in the importation
|
||||
profile
|
||||
* commission_amount: amount of the comission for each line
|
||||
* label: the comunication given by the payment office, used as communication in the
|
||||
generated entries.
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': [],
|
||||
'installable': True,
|
||||
'images': [],
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
* label: the comunication given by the payment office, used as communication in
|
||||
the generated entries.
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
|
||||
@@ -22,24 +22,24 @@ from account_statement_base_import.parser.file_parser import FileParser
|
||||
|
||||
|
||||
class TransactionIDFileParser(FileParser):
|
||||
|
||||
"""
|
||||
TransactionID parser that use a define format in csv or xls to import
|
||||
"""TransactionID parser that use a define format in csv or xls to import
|
||||
bank statement.
|
||||
"""
|
||||
|
||||
def __init__(self, profile, ftype='csv', extra_fields=None, header=None, **kwargs):
|
||||
"""
|
||||
Add transaction_id in header keys
|
||||
def __init__(self, profile, ftype='csv', extra_fields=None, header=None,
|
||||
**kwargs):
|
||||
"""Add transaction_id in header keys
|
||||
:param char: profile: Reference to the profile
|
||||
:param char: ftype: extension of the file (could be csv or xls)
|
||||
:param dict: extra_fields: extra fields to add to the conversion dict. In the format
|
||||
{fieldname: fieldtype}
|
||||
:param list: header : specify header fields if the csv file has no header
|
||||
"""
|
||||
:param dict: extra_fields: extra fields to add to the conversion \
|
||||
dict. In the format {fieldname: fieldtype}
|
||||
:param list: header : specify header fields if the csv file has no \
|
||||
header
|
||||
"""
|
||||
extra_fields = {'transaction_id': unicode}
|
||||
super(TransactionIDFileParser, self).__init__(profile, extra_fields=extra_fields,
|
||||
ftype=ftype, header=header, **kwargs)
|
||||
super(TransactionIDFileParser, self).__init__(
|
||||
profile, extra_fields=extra_fields, ftype=ftype, header=header,
|
||||
**kwargs)
|
||||
# ref is replaced by transaction_id thus we delete it from check
|
||||
self.keys_to_validate = [
|
||||
k for k in self.keys_to_validate if k != 'ref']
|
||||
@@ -47,21 +47,20 @@ class TransactionIDFileParser(FileParser):
|
||||
|
||||
@classmethod
|
||||
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 generic_csvxls_transaction
|
||||
"""
|
||||
return parser_name == 'generic_csvxls_transaction'
|
||||
|
||||
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 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,
|
||||
it MUST contain at least:
|
||||
: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, it MUST contain at least:
|
||||
{
|
||||
'name':value,
|
||||
'date':value,
|
||||
@@ -70,13 +69,15 @@ class TransactionIDFileParser(FileParser):
|
||||
'label':value,
|
||||
'commission_amount':value,
|
||||
}
|
||||
In this generic parser, the commission is given for every line, so we store it
|
||||
for each one.
|
||||
In this generic parser, the commission is given for every line, so we
|
||||
store it for each one.
|
||||
"""
|
||||
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('transaction_id', '/'),
|
||||
'label': line.get('label', ''),
|
||||
'transaction_id': line.get('transaction_id', '/'),
|
||||
'commission_amount': line.get('commission_amount', 0.0)}
|
||||
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('transaction_id', '/'),
|
||||
'label': line.get('label', ''),
|
||||
'transaction_id': line.get('transaction_id', '/'),
|
||||
'commission_amount': line.get('commission_amount', 0.0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user