[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: cbc52f80eb

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
This commit is contained in:
Denis Ledoux 2015-01-19 14:15:58 +01:00
parent af8c2e4db6
commit 447f8cf496
1 changed files with 6 additions and 1 deletions

View File

@ -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'], '')