From 447f8cf49603d1e338ec857e50f02e6600dd7189 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 19 Jan 2015 14:15:58 +0100 Subject: [PATCH] [FIX] l10n_be_coda: globalisation stack The first line having the globalisation code is the globalized amount, then the next line having this same globalisation code is the last line of the globalisation (the last children). The first line must no be included in the bank statement, but the last line must (as this is a real children line) This is a regression of commit: cbc52f80eb0424a6bc2947d10d150dd3833d0100 Official doc concerning globalization code: The value which is mentioned (1 to 9), specifies the hierarchy level of the globalisation of which this record is the first. The same code will be repeated at the end of the globalisation --- addons/l10n_be_coda/wizard/account_coda_import.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 3dec320323f..e22752f47ff 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -70,6 +70,7 @@ class account_coda_import(osv.osv_memory): statement['version'] = line[127] if statement['version'] not in ['1', '2']: raise osv.except_osv(_('Error') + ' R001', _('CODA V%s statements are not supported, please contact your bank') % statement['version']) + statement['globalisation_stack'] = [] statement['lines'] = [] statement['date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[5:11]), '%d%m%y')) statement['separateApplication'] = rmspaces(line[83:88]) @@ -155,7 +156,11 @@ class account_coda_import(osv.osv_memory): statementLine['type'] = 'normal' statementLine['globalisation'] = int(line[124]) if statementLine['globalisation'] > 0: - statementLine['type'] = 'globalisation' + if statementLine['globalisation'] in statement['globalisation_stack']: + statement['globalisation_stack'].remove(statementLine['globalisation']) + else: + statementLine['type'] = 'globalisation' + statement['globalisation_stack'].append(statementLine['globalisation']) globalisation_comm[statementLine['ref_move']] = statementLine['communication'] if not statementLine.get('communication'): statementLine['communication'] = globalisation_comm.get(statementLine['ref_move'], '')