[IMP] ing: allow for CSV files in both date formats

This commit is contained in:
Stefan Rijnhart
2012-10-04 10:56:19 +02:00
parent 1b136b9eb9
commit df8d20c359
3 changed files with 12 additions and 6 deletions

View File

@@ -31,9 +31,9 @@
##############################################################################
{
'name': 'ING (NL) Bank Statements Import',
'version': '0.1.105',
'version': '0.1.140',
'license': 'GPL-3',
'author': 'Smile / Therp BV / EduSense BV',
'author': ['Smile', 'Therp BV', 'EduSense BV'],
'website': 'https://launchpad.net/banking-addons',
'category': 'Banking addons',
'depends': ['account_banking'],
@@ -43,7 +43,7 @@
'demo_xml': [],
'description': '''
Module to import Dutch ING bank format transaction files. The format covered
is the CSV format with 'ddmmyy' date syntax.
is the CSV format with either 'dd-mm-yyyy' or 'yyyymmdd' date syntax.
As the ING bank does not provide detailed specification concerning possible
values and their meaning for the fields in the CSV file format, the statements

View File

@@ -24,7 +24,7 @@ msgstr "ING (NL) Bankafschriften importeren "
#: model:ir.module.module,description:account_banking_nl_ing.module_meta_information
msgid "Module to import Dutch ING bank format transaction files. The format covered is the CSV format with 'ddmmyy' date syntax.As the ING bank does not provide detailed specification concerning possiblevalues and their meaning for the fields in the CSV file format, the statementsare parsed according to an educated guess based on incomplete information.You can contact the banking-addons developers through their launchpad page andhelp improve the performance of this import filter onhttps://launchpad.net/banking-addons.Note that imported bank transfers are organized in statements covering periodsof one week, even if the imported files cover a different period.This modules contains no logic, just an import filter for account_banking. "
msgstr "Module voor het importeren van bankafschriften van de Nederlandse ING bank.\n"
"Bestanden in het CSV-formaat met datumindeling 'ddmmjj' kunnen worden verwerkt.\n\n"
"Bestanden in het CSV-formaat met datumindeling 'dd-mm-jjjj' of 'jjjjmmdd' kunnen worden verwerkt.\n\n"
"Gezien het feit dat de ING geen enkele vorm van specificaties\n"
"beschikbaar stelt, is de importroutine samengesteld op basis van \n"
"voorbeeldbestanden, en kan volledige dekking niet worden gegarandeerd. U\n"

View File

@@ -67,7 +67,10 @@ class transaction_message(object):
re.sub(',', '.', self.transferred_amount))
if self.debcred == 'Af':
self.transferred_amount = -self.transferred_amount
self.execution_date = self.effective_date = str2date(self.date, '%Y%m%d')
try:
self.execution_date = self.effective_date = str2date(self.date, '%Y%m%d')
except ValueError:
self.execution_date = self.effective_date = str2date(self.date, '%d-%m-%Y')
self.statement_id = '' #self.effective_date.strftime('%Yw%W')
self.id = str(subno).zfill(4)
self.reference = ''
@@ -178,7 +181,10 @@ class statement(models.mem_bank_statement):
super(statement, self).__init__(*args, **kwargs)
self.id = msg.statement_id
self.local_account = msg.local_account
self.date = str2date(msg.date, '%Y%m%d')
try:
self.date = str2date(msg.date, '%Y%m%d')
except ValueError:
self.date = str2date(msg.date, '%d-%m-%Y')
self.start_balance = self.end_balance = 0 # msg.start_balance
self.import_transaction(msg)