-
-
-
-
- coda.bank.statement.search
- coda.bank.statement
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CODA Bank Statements
- ir.actions.act_window
- coda.bank.statement
- form
- tree,form
-
-
- The CODA Bank Statements contain the information encoded in their originating CODA file in a human readable format. The Bank Statements associated with a CODA contain the subset of the CODA Bank Statement data that is required for the creation of the Accounting Entries.
-
-
-
-
-
-
-
- coda.bank.statement.line.list
- coda.bank.statement.line
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- coda.bank.statement.line.form
- coda.bank.statement.line
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- coda.bank.statement.line.filter
- coda.bank.statement.line
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CODA Statement Lines
- coda.bank.statement.line
- form
- tree,form
- {'block_statement_line_delete' : 1}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/addons/l10n_be_coda/l10n_be_coda_wizard.xml b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
index 76178820d9c..427e0c1991e 100644
--- a/addons/l10n_be_coda/l10n_be_coda_wizard.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
@@ -49,20 +49,6 @@
new
-
-
-
-
diff --git a/addons/l10n_be_coda/res_bank.py b/addons/l10n_be_coda/res_bank.py
deleted file mode 100755
index 47e7fdf8569..00000000000
--- a/addons/l10n_be_coda/res_bank.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-#
-# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields, osv
-
-
-class res_bank(osv.osv):
- _inherit = 'res.bank'
- _columns = {
- 'code': fields.char('Code', size=3,
- help='Country specific Bank Code (used for bban to iban conversion).'),
- }
-res_bank()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/res_bank_view.xml b/addons/l10n_be_coda/res_bank_view.xml
deleted file mode 100755
index fe4a71d2bdb..00000000000
--- a/addons/l10n_be_coda/res_bank_view.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- res.bank.form.add.code
- res.bank
-
- form
-
-
-
-
-
-
-
-
- res.bank.tree.add.code
- res.bank
-
- form
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/l10n_be_coda/security/account_security.xml b/addons/l10n_be_coda/security/account_security.xml
deleted file mode 100644
index b8fdd32ebe6..00000000000
--- a/addons/l10n_be_coda/security/account_security.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- Account Coda model company rule
-
-
- ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
-
-
-
diff --git a/addons/l10n_be_coda/security/ir.model.access.csv b/addons/l10n_be_coda/security/ir.model.access.csv
deleted file mode 100644
index 89ee65048fb..00000000000
--- a/addons/l10n_be_coda/security/ir.model.access.csv
+++ /dev/null
@@ -1,17 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_account_coda_manager,account.coda manager,model_account_coda,account.group_account_manager,1,1,1,1
-access_account_coda_user,account.coda user,model_account_coda,account.group_account_user,1,0,0,0
-access_account_coda_trans_type_manager,account.coda.trans.type manager,model_account_coda_trans_type,account.group_account_manager,1,1,1,1
-access_account_coda_trans_type_user,account.coda.trans.type user,model_account_coda_trans_type,account.group_account_user,1,0,0,0
-access_account_coda_trans_code_manager,account.coda.trans.code manager,model_account_coda_trans_code,account.group_account_manager,1,1,1,1
-access_account_coda_trans_code_user,account.coda.trans.code user,model_account_coda_trans_code,account.group_account_user,1,0,0,0
-access_account_coda_trans_category_manager,account.coda.trans.category manager,model_account_coda_trans_category,account.group_account_manager,1,1,1,1
-access_account_coda_trans_category_user,account.coda.trans.category user,model_account_coda_trans_category,account.group_account_user,1,0,0,0
-access_account_coda_comm_type_manager,account.coda.comm.type manager,model_account_coda_comm_type,account.group_account_manager,1,1,1,1
-access_account_coda_comm_type_user,account.coda.comm.type user,model_account_coda_comm_type,account.group_account_user,1,0,0,0
-access_coda_bank_account_manager,coda.bank.account manager,model_coda_bank_account,account.group_account_manager,1,1,1,1
-access_coda_bank_account_user,coda.bank.account user,model_coda_bank_account,account.group_account_user,1,0,0,0
-access_coda_bank_statement_manager,coda.bank.statement manager,model_coda_bank_statement,account.group_account_manager,1,1,1,1
-access_coda_bank_statement_user,coda.bank.statement user,model_coda_bank_statement,account.group_account_user,1,0,0,0
-access_coda_bank_statement_line_manager,coda.bank.statement.line manager,model_coda_bank_statement_line,account.group_account_manager,1,1,1,1
-access_coda_bank_statement_line_user,coda.bank.statement.line user,model_coda_bank_statement_line,account.group_account_user,1,0,0,0
diff --git a/addons/l10n_be_coda/wizard/__init__.py b/addons/l10n_be_coda/wizard/__init__.py
index 3851606707b..e3038609b80 100644
--- a/addons/l10n_be_coda/wizard/__init__.py
+++ b/addons/l10n_be_coda/wizard/__init__.py
@@ -20,6 +20,6 @@
#
##############################################################################
-import account_coda_import_dle
+import account_coda_import
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index bb165cf1656..b63b29701d8 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -20,14 +20,11 @@
#
##############################################################################
-import time
import base64
from osv import fields, osv
from tools.translate import _
-import netsvc
-import re
-from traceback import format_exception
-from sys import exc_info
+import time
+import tools
import logging
_logger = logging.getLogger(__name__)
@@ -44,14 +41,11 @@ class account_coda_import(osv.osv_memory):
'coda_fname': lambda *a: '',
}
- def _check_account_payment(self, cr, uid, context=None):
- res = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', 'account_payment'), ('state', '=', 'installed')])
- return res and True or False
-
def coda_parsing(self, cr, uid, ids, context=None, batch=False, codafile=None, codafilename=None):
if context is None:
context = {}
if batch:
+ print
codafile = str(codafile)
codafilename = codafilename
else:
@@ -62,1866 +56,685 @@ class account_coda_import(osv.osv_memory):
except:
raise osv.except_osv(_('Error!'), _('Wizard in incorrect state. Please hit the Cancel button!'))
return {}
-
- currency_obj = self.pool.get('res.currency')
- coda_bank_account_obj = self.pool.get('coda.bank.account')
- trans_type_obj = self.pool.get('account.coda.trans.type')
- trans_code_obj = self.pool.get('account.coda.trans.code')
- trans_category_obj = self.pool.get('account.coda.trans.category')
- comm_type_obj = self.pool.get('account.coda.comm.type')
- journal_obj = self.pool.get('account.journal')
- period_obj = self.pool.get('account.period')
- partner_bank_obj = self.pool.get('res.partner.bank')
- coda_obj = self.pool.get('account.coda')
- coda_st_obj = self.pool.get('coda.bank.statement')
- coda_st_line_obj = self.pool.get('coda.bank.statement.line')
- bank_st_obj = self.pool.get('account.bank.statement')
- bank_st_line_obj = self.pool.get('account.bank.statement.line')
- glob_obj = self.pool.get('account.bank.statement.line.global')
- inv_obj = self.pool.get('account.invoice')
- move_line_obj = self.pool.get('account.move.line')
- voucher_obj = self.pool.get('account.voucher')
- seq_obj = self.pool.get('ir.sequence')
- mod_obj = self.pool.get('ir.model.data')
- account_mapping_obj = self.pool.get('coda.account.mapping.rule')
-
- if self._check_account_payment(cr, uid):
- payment_line_obj = self.pool.get('payment.line')
- else:
- payment_line_obj = False
-
- wf_service = netsvc.LocalService('workflow')
-
- coda_bank_table = coda_bank_account_obj.read(cr, uid, coda_bank_account_obj.search(cr, uid, []), context=context)
- for coda_bank in coda_bank_table:
- coda_bank.update({'journal_code': coda_bank['journal'] and journal_obj.browse(cr, uid, coda_bank['journal'][0], context=context).code or ''})
- coda_bank.update({'iban': partner_bank_obj.browse(cr, uid, coda_bank['bank_id'][0], context=context).iban})
- coda_bank.update({'acc_number': partner_bank_obj.browse(cr, uid, coda_bank['bank_id'][0], context=context).acc_number})
- coda_bank.update({'currency_name': currency_obj.browse(cr, uid, coda_bank['currency'][0], context=context).name})
- trans_type_table = trans_type_obj.read(cr, uid, trans_type_obj.search(cr, uid, []), context=context)
- trans_code_table = trans_code_obj.read(cr, uid, trans_code_obj.search(cr, uid, []), context=context)
- trans_category_table = trans_category_obj.read(cr, uid, trans_category_obj.search(cr, uid, []), context=context)
- comm_type_table = comm_type_obj.read(cr, uid, comm_type_obj.search(cr, uid, []), context=context)
-
- err_string = ''
- err_code = None
- err_log = ''
- coda_statements = []
recordlist = unicode(base64.decodestring(codafile), 'windows-1252', 'strict').split('\n')
- digits = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
-
+ statements = []
for line in recordlist:
-
if not line:
pass
elif line[0] == '0':
- # start of a new statement within the CODA file
- coda_statement = {}
- coda_parsing_note = ''
- coda_statement_lines = {}
- st_line_seq = 0
- # header data
- coda_statement['currency'] = 'EUR' # default currency
- coda_statement['version'] = line[127]
- coda_version = line[127]
- if coda_version not in ['1', '2']:
- err_string = _('\nCODA V%s statements are not supported, please contact your bank!') % coda_version
- err_code = 'R0001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- coda_statement['coda_statement_lines'] = {}
- coda_statement['date'] = str2date(line[5:11])
- coda_statement['coda_creation_date'] = str2date(line[5:11])
- coda_statement['separate_application'] = line[83:88]
- coda_statement['first_transaction_date'] = False
- coda_statement['state'] = 'draft'
-
- coda_id = coda_obj.search(cr, uid, [
- ('name', '=', codafilename),
- ('coda_creation_date', '=', coda_statement['date']),
- ])
- if coda_id:
- err_string = _("\nCODA File with Filename '%s' and Creation Date '%s' has already been imported !") \
- % (codafilename, coda_statement['date'])
- err_code = 'W0001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Warning !'), err_string)
-
+ #Begin of a new Bank statement
+ statement = {}
+ statements.append(statement)
+ 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])
elif line[0] == '1':
- if coda_version == '1':
- coda_statement['acc_number'] = line[5:17]
- if line[18:21].strip():
- coda_statement['currency'] = line[18:21]
- elif line[1] == '0': # Belgian bank account BBAN structure
- coda_statement['acc_number'] = line[5:17]
- coda_statement['currency'] = line[18:21]
- elif line[1] == '1': # foreign bank account BBAN structure
- err_string = _('\nForeign bank accounts with BBAN structure are not supported !')
- err_code = 'R1001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- elif line[1] == '2': # Belgian bank account IBAN structure
- coda_statement['acc_number'] = line[5:21]
- coda_statement['currency'] = line[39:42]
- elif line[1] == '3': # foreign bank account IBAN structure
- err_string = _('\nForeign bank accounts with IBAN structure are not supported !')
- err_code = 'R1002'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- else:
- err_string = _('\nUnsupported bank account structure !')
- err_code = 'R1003'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- coda_statement['description'] = line[90:125].strip()
- cba_filter = lambda x: (coda_statement['acc_number'] in _get_acc_numbers(x['acc_number'])) \
- and (coda_statement['currency'] == x['currency_name']) and (coda_statement['description'] in [x['description1'] or '', x['description2'] or ''])
- coda_bank = filter(cba_filter, coda_bank_table)
- if coda_bank:
- coda_bank = coda_bank[0]
- coda_statement['type'] = coda_bank['state']
- coda_statement['journal_id'] = coda_bank['journal'] and coda_bank['journal'][0]
- coda_statement['currency_id'] = coda_bank['currency'][0]
- coda_statement['coda_bank_account_id'] = coda_bank['id']
- coda_statement['account_mapping_ids'] = coda_bank['account_mapping_ids']
- coda_statement['coda_bank_params'] = coda_bank
- awaiting_acc = coda_bank['awaiting_account'][0]
- transfer_acc = coda_bank['transfer_account'][0]
- find_payment = coda_bank['find_payment']
- find_bbacom = coda_bank['find_bbacom']
- find_inv_number = coda_bank['find_inv_number']
- find_partner = coda_bank['find_partner']
- update_partner = coda_bank['update_partner']
- coda_statement['balance_start_enforce'] = coda_bank['balance_start_enforce']
- coda_statement['discard_dup'] = coda_bank['discard_dup']
- company_id = coda_bank['company_id'][0]
- company_bank_ids = partner_bank_obj.search(cr, uid, [('company_id', '=', company_id)])
- company_bank_accounts = partner_bank_obj.read(cr, uid, company_bank_ids, ['acc_number'])
- company_bank_accounts = [x['acc_number'].replace(' ', '') for x in company_bank_accounts]
- else:
- err_string = _("\nNo matching CODA Bank Account Configuration record found !") + \
- _("\nPlease check if the 'Bank Account Number', 'Currency' and 'Account Description' fields of your configuration record match with '%s', '%s' and '%s' !") \
- % (coda_statement['acc_number'], coda_statement['currency'], coda_statement['description'])
- err_code = 'R1004'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- bal_start = list2float(line[43:58]) # old balance data
- if line[42] == '1': # 1= Debit
- bal_start = - bal_start
- coda_statement['balance_start'] = bal_start
- coda_statement['old_balance_date'] = str2date(line[58:64])
- coda_statement['acc_holder'] = line[64:90]
- coda_statement['paper_ob_seq_number'] = line[2:5]
- coda_statement['coda_seq_number'] = line[125:128]
-
+ #Statement details
+ if statement['version'] == '1':
+ statement['accountNumber'] = rmspaces(line[5:17])
+ statement['currency'] = rmspaces(line[18:21])
+ elif statement['version'] == '2':
+ if line[1] == '0': # Belgian bank account BBAN structure
+ statement['accountNumber'] = rmspaces(line[5:17])
+ statement['currency'] = rmspaces(line[18:21])
+ elif line[1] == '1': # foreign bank account BBAN structure
+ raise osv.except_osv(_('Error R1001!'), _('Foreign bank accounts with BBAN structure are not supported !'))
+ elif line[1] == '2': # Belgian bank account IBAN structure
+ statement['accountNumber'] = rmspaces(line[5:21])
+ statement['currency'] = rmspaces(line[39:42])
+ elif line[1] == '3': # foreign bank account IBAN structure
+ raise osv.except_osv(_('Error R1002!'), _('Foreign bank accounts with IBAN structure are not supported !'))
+ else: # Something else, not supported
+ raise osv.except_osv(_('Error R1003!'), _('Unsupported bank account structure !'))
+ statement['description'] = rmspaces(line[90:125])
+ statement['balance_start'] = float(rmspaces(line[43:58])) / 1000
+ statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y'))
+ statement['accountHolder'] = rmspaces(line[64:90])
+ statement['paperSeqNumber'] = rmspaces(line[2:5])
+ statement['codaSeqNumber'] = rmspaces(line[125:128])
elif line[0] == '2':
- # movement data record 2
-
if line[1] == '1':
- # movement data record 2.1
- st_line = {}
- st_line_seq = st_line_seq + 1
- st_line['sequence'] = st_line_seq
- st_line['type'] = 'general'
- st_line['reconcile'] = False
- st_line['trans_family'] = False
- st_line['struct_comm_type'] = ''
- st_line['struct_comm_type_id'] = 0
- st_line['struct_comm_type_desc'] = ''
- st_line['struct_comm_bba'] = ''
- st_line['communication'] = ''
- st_line['payment_reference'] = ''
- st_line['partner_id'] = 0
- st_line['account_id'] = 0
- st_line['counterparty_name'] = ''
- st_line['counterparty_bic'] = ''
- st_line['counterparty_number'] = ''
- st_line['counterparty_currency'] = ''
- st_line['glob_lvl_flag'] = False
- st_line['globalisation_id'] = 0
- st_line['globalisation_code'] = ''
- st_line['globalisation_amount'] = False
- st_line['amount'] = False
-
- st_line['ref'] = line[2:10]
- st_line['ref_move'] = line[2:6]
- st_line['ref_move_detail'] = line[6:10]
-
- if st_line_seq == 1:
- main_move_stack = [st_line] # initialise main_move_stack (used to link 2.1 detail records to 2.1 main record
- glob_lvl_stack = [0] # initialise globalisation stack
- elif st_line['ref_move_detail'] == '0000':
- glob_lvl_stack = [0] # re-initialise globalisation stack
-
- st_line['trans_ref'] = line[10:31]
- st_line_amt = list2float(line[32:47])
- if line[31] == '1': # 1=debit
- st_line_amt = - st_line_amt
-
- st_line['trans_type'] = line[53]
- trans_type = filter(lambda x: st_line['trans_type'] == x['type'], trans_type_table)
- if not trans_type:
- err_string = _('\nThe File contains an invalid CODA Transaction Type : %s!') % st_line['trans_type']
- err_code = 'R2001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- st_line['trans_type_id'] = trans_type[0]['id']
- st_line['trans_type_desc'] = trans_type[0]['description']
-
- # processing of amount depending on globalisation code
- glob_lvl_flag = int(line[124])
- if glob_lvl_flag > 0:
- if glob_lvl_stack[-1] == glob_lvl_flag:
- st_line['glob_lvl_flag'] = glob_lvl_flag
- st_line['amount'] = st_line_amt
- glob_lvl_stack.pop()
+ #New statement line
+ statementLine = {}
+ statementLine['type'] = 'general'
+ statementLine['ref'] = rmspaces(line[2:10])
+ statementLine['ref_move'] = rmspaces(line[2:6])
+ statementLine['ref_move_detail'] = rmspaces(line[6:10])
+ statementLine['sequence'] = len(statement['lines']) + 1
+ statementLine['transactionRef'] = rmspaces(line[10:31])
+ statementLine['debit'] = line[31] # 0 = Credit, 1 = Debit
+ statementLine['amount'] = float(rmspaces(line[32:47])) / 1000
+ if statementLine['debit'] == '1':
+ statementLine['amount'] = - statementLine['amount']
+ statementLine['transaction_type'] = line[53]
+ if statementLine['transaction_type'] not in transaction_types:
+ raise osv.except_osv(_('Error R2001!'), _('The File contains an invalid CODA Transaction Type : %s!') % statementLine['transaction_type'])
+ statementLine['transactionDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[47:53]), '%d%m%y'))
+ statementLine['transaction_family'] = rmspaces(line[54:56])
+ #TODO Handling severals transactions Family
+ statementLine['transaction_code'] = rmspaces(line[56:58])
+ #TODO Handling severals transactions code
+ statementLine['transaction_category'] = rmspaces(line[58:61])
+ #TODO Handling severals transactions category
+ statementLine['communication'] = rmspaces(line[62:115])
+ #TODO Handling structured communication
+ statementLine['entryDate'] = rmspaces(line[115:121])
+ statementLine['type'] = 'normal'
+ statementLine['globalisation'] = int(line[124])
+ if len(statement['globalisation_stack']) > 0 and statementLine['communication'] != '':
+ statementLine['communication'] = "\n".join([statement['globalisation_stack'][-1]['communication'], statementLine['communication']])
+ if statementLine['globalisation'] > 0:
+ if len(statement['globalisation_stack']) > 0 and statement['globalisation_stack'][-1]['globalisation'] == statementLine['globalisation']:
+ # Destack
+ statement['globalisation_stack'].pop()
else:
- glob_lvl_stack.append(glob_lvl_flag)
- st_line['type'] = 'globalisation'
- st_line['glob_lvl_flag'] = glob_lvl_flag
- st_line['globalisation_amount'] = st_line_amt
- else:
- st_line['amount'] = st_line_amt
-
- # The 'globalisation' concept can also be implemented without the globalisation level flag.
- # This is e.g. used by Europabank to give the details of Card Payments.
- if st_line['ref_move'] == main_move_stack[-1]['ref_move']:
- if st_line['ref_move_detail'] == '9999':
- # Current CODA parsing logic doesn't support > 9999 detail lines
- err_string = _('\nTransaction Detail Limit reached!')
- err_code = 'R2010'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- elif st_line['ref_move_detail'] != '0000':
- if glob_lvl_stack[-1] == 0:
- # promote associated move record into a globalisation
- glob_lvl_flag = 1
- glob_lvl_stack.append(glob_lvl_flag)
- main_st_line_seq = main_move_stack[-1]['sequence']
- to_promote = coda_statement['coda_statement_lines'][main_st_line_seq]
- if not main_move_stack[-1].get('detail_cnt'):
- to_promote.update({
- 'type': 'globalisation',
- 'glob_lvl_flag': glob_lvl_flag,
- 'globalisation_amount': main_move_stack[-1]['amount'],
- 'amount': False,
- 'account_id': 0,
- })
- main_move_stack[-1]['promoted'] = True
- if not main_move_stack[-1].get('detail_cnt'):
- main_move_stack[-1]['detail_cnt'] = 1
- else:
- main_move_stack[-1]['detail_cnt'] += 1
-
- # positions 48-53 : Valuta date or 000000 if not known (DDMMYY)
- st_line['val_date'] = str2date(line[47:53])
- # positions 54-61 : transaction code
- st_line['trans_family'] = line[54:56]
- trans_family = filter(lambda x: (x['type'] == 'family') and (st_line['trans_family'] == x['code']), trans_code_table)
- if not trans_family:
- err_string = _('\nThe File contains an invalid CODA Transaction Family : %s!') % st_line['trans_family']
- err_code = 'R2002'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- st_line['trans_family_id'] = trans_family[0]['id']
- st_line['trans_family_desc'] = trans_family[0]['description']
- st_line['trans_code'] = line[56:58]
- trans_code = filter(lambda x: (x['type'] == 'code') and (st_line['trans_code'] == x['code']) and (trans_family[0]['id'] == x['parent_id'][0]),
- trans_code_table)
- if trans_code:
- st_line['trans_code_id'] = trans_code[0]['id']
- st_line['trans_code_desc'] = trans_code[0]['description']
- else:
- st_line['trans_code_id'] = None
- st_line['trans_code_desc'] = _('Transaction Code unknown, please consult your bank.')
- st_line['trans_category'] = line[58:61]
- trans_category = filter(lambda x: st_line['trans_category'] == x['category'], trans_category_table)
- if trans_category:
- st_line['trans_category_id'] = trans_category[0]['id']
- st_line['trans_category_desc'] = trans_category[0]['description']
- else:
- st_line['trans_category_id'] = None
- st_line['trans_category_desc'] = _('Transaction Category unknown, please consult your bank.')
- # positions 61-115 : communication
- if line[61] == '1':
- st_line['struct_comm_type'] = line[62:65]
- comm_type = filter(lambda x: st_line['struct_comm_type'] == x['code'], comm_type_table)
- if not comm_type:
- err_string = _('\nThe File contains an invalid Structured Communication Type : %s!') % st_line['struct_comm_type']
- err_code = 'R2003'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- st_line['struct_comm_type_id'] = comm_type[0]['id']
- st_line['struct_comm_type_desc'] = comm_type[0]['description']
- st_line['communication'] = st_line['name'] = line[65:115]
- if st_line['struct_comm_type'] in ['101', '102']:
- bbacomm = line[65:77]
- st_line['struct_comm_bba'] = st_line['name'] = '+++' + bbacomm[0:3] + '/' + bbacomm[3:7] + '/' + bbacomm[7:] + '+++'
- else:
- st_line['communication'] = st_line['name'] = line[62:115]
- st_line['entry_date'] = str2date(line[115:121])
- if st_line['sequence'] == 1:
- coda_statement['first_transaction_date'] = st_line['entry_date']
- # positions 122-124 not processed
- coda_statement_lines[st_line_seq] = st_line # store transaction
-
- if st_line['ref_move'] != main_move_stack[-1]['ref_move']:
- if main_move_stack[-1].get('detail_cnt') and main_move_stack[-1].get('promoted'):
- # add closing globalisation level on previous detail record in order to correctly close
- # moves that have been 'promoted' to globalisation
- closeglobalise = coda_statement['coda_statement_lines'][st_line_seq - 1]
- closeglobalise.update({
- 'glob_lvl_flag': main_move_stack[-1]['glob_lvl_flag'],
- })
- else:
- # demote record with globalisation code from 'globalisation' to 'general' when no detail records
- # the same logic is repeated on the New Balance Record ('8 Record') in order to cope with CODA files
- # containing a single 2.1 record that needs to be 'demoted'.
- if main_move_stack[-1]['type'] == 'globalisation' and not main_move_stack[-1].get('detail_cnt'):
- # demote record with globalisation code from 'globalisation' to 'general' when no detail records
- main_st_line_seq = main_move_stack[-1]['sequence']
- to_demote = coda_statement['coda_statement_lines'][main_st_line_seq]
- to_demote.update({
- 'type': 'general',
- 'glob_lvl_flag': 0,
- 'globalisation_amount': False,
- 'amount': main_move_stack[-1]['globalisation_amount'],
- })
- main_move_stack.pop()
- main_move_stack.append(st_line)
- coda_statement['coda_statement_lines'] = coda_statement_lines
-
+ #Stack
+ statementLine['type'] = 'globalisation'
+ statement['globalisation_stack'].append(statementLine)
+ statement['lines'].append(statementLine)
elif line[1] == '2':
- # movement data record 2.2
- if coda_statement['coda_statement_lines'][st_line_seq]['ref'][0:4] != line[2:6]:
- err_string = _('\nCODA parsing error on movement data record 2.2, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R2004'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
- coda_statement['coda_statement_lines'][st_line_seq]['name'] += line[10:63]
- coda_statement['coda_statement_lines'][st_line_seq]['communication'] += line[10:63]
- coda_statement['coda_statement_lines'][st_line_seq]['payment_reference'] = line[63:98].strip()
- coda_statement['coda_statement_lines'][st_line_seq]['counterparty_bic'] = line[98:109].strip()
-
+ if statement['lines'][-1]['ref'][0:4] != line[2:6]:
+ raise osv.except_osv(_('Error R2004!'), _('CODA parsing error on movement data record 2.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ statement['lines'][-1]['communication'] += rmspaces(line[10:63])
+ statement['lines'][-1]['payment_reference'] = rmspaces(line[63:98])
+ statement['lines'][-1]['counterparty_bic'] = rmspaces(line[98:109])
elif line[1] == '3':
- # movement data record 2.3
- if coda_statement['coda_statement_lines'][st_line_seq]['ref'][0:4] != line[2:6]:
- err_string = _('\nCODA parsing error on movement data record 2.3, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R2005'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
- st_line = coda_statement_lines[st_line_seq]
- if coda_version == '1':
- counterparty_number = line[10:22].strip()
- counterparty_name = line[47:125].strip()
- counterparty_currency = ''
+ if statement['lines'][-1]['ref'][0:4] != line[2:6]:
+ raise osv.except_osv(_('Error R2005!'), _('CODA parsing error on movement data record 2.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ if statement['version'] == '1':
+ statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
+ statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:125])
+ statement['lines'][-1]['counterpartyCurrency'] = ''
else:
if line[22] == ' ':
- counterparty_number = line[10:22].strip()
- counterparty_currency = line[23:26].strip()
+ statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
+ statement['lines'][-1]['counterpartyCurrency'] = rmspaces(line[23:26])
else:
- counterparty_number = line[10:44].strip()
- counterparty_currency = line[44:47].strip()
- counterparty_name = line[47:82].strip()
- st_line['name'] += line[82:125]
- st_line['communication'] += line[82:125]
- st_line['counterparty_number'] = counterparty_number
- st_line['counterparty_currency'] = counterparty_currency
- st_line['counterparty_name'] = counterparty_name
- """
- TO DO:
-
- replace code infra by check on flag 128 and copy info in Notes Field.
-
- if counterparty_currency not in [coda_bank['currency_name'], '']:
- err_string = _('\nCODA parsing error on movement data record 2.3, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R2006'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
- """
-
- # invoice matching and reconciliation
- if st_line['type'] == 'general':
- match = False
- payment_reference_match = False
- inv_ids = None
- partner_bank_ids = False
-
- # check payment reference in bank statement line against payment order lines
- payment_reference = st_line['payment_reference']
- if payment_reference and find_payment and st_line['amount'] < 0:
- payline_ids = payment_line_obj and payment_line_obj.search(cr, uid, [('name', '=', payment_reference)])
- if payline_ids:
- if len(payline_ids) == 1:
- payline = payment_line_obj.browse(cr, uid, payline_ids[0])
- match = True
- payment_reference_match = True
- st_line['partner_id'] = payline.partner_id.id
- if payline.move_line_id:
- st_line['reconcile'] = payline.move_line_id.id
- st_line['account_id'] = payline.move_line_id.account_id.id
- if payline._get_ml_inv_ref:
- inv_type = payline.ml_inv_ref.type
- st_line['type'] = inv_type == 'in_invoice' and 'supplier' or 'customer'
- else:
- st_line['type'] = 'general'
- else:
- err_string = _('\nThe CODA parsing detected a payment reference ambiguity while processing movement data record 2.3, seq nr %s!' \
- '\nPlease check your Payment Gateway configuration or contact your OpenERP support channel.') % line[2:10]
- err_code = 'R2007'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
-
- # check bba scor in bank statement line against open invoices
- if st_line['struct_comm_bba'] and find_bbacom:
- if st_line['amount'] > 0:
- domain = [('type', 'in', ['out_invoice', 'in_refund'])]
- else:
- domain = [('type', 'in', ['in_invoice', 'out_refund'])]
- inv_ids = inv_obj.search(cr, uid,
- domain + [('state', '=', 'open'), ('reference', '=', st_line['struct_comm_bba']), ('reference_type', '=', 'bba')])
- if not inv_ids:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n There is no invoice matching the Structured Communication '%s'!" \
- "\n Please verify and adjust the invoice and perform the import again or otherwise change the corresponding entry manually in the generated Bank Statement.") \
- % (st_line['ref'], st_line['struct_comm_bba'])
- elif len(inv_ids) == 1:
- match = True
- elif len(inv_ids) > 1:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n There are multiple invoices matching the Structured Communication '%s'!" \
- "\n A manual reconciliation is required.") \
- % (st_line['ref'], st_line['struct_comm_bba'])
-
- # use free comm in bank statement line for lookup against open invoices
- if not match and find_bbacom:
- # extract possible bba scor from free form communication and try to find matching invoice
- free_comm_digits = re.sub('\D', '', st_line['communication'] or '')
- select = "SELECT id FROM (SELECT id, type, state, amount_total, number, reference_type, reference, " \
- "'%s'::text AS free_comm_digits FROM account_invoice) sq " \
- "WHERE state = 'open' AND reference_type = 'bba' " \
- "AND free_comm_digits LIKE '%%'||regexp_replace(reference, '\\\D', '', 'g')||'%%'" \
- % (free_comm_digits)
- if st_line['amount'] > 0:
- select2 = " AND type IN ('out_invoice', 'in_refund')"
- else:
- select2 = " AND type IN ('in_invoice', 'out_refund')"
- cr.execute(select + select2)
- res = cr.fetchall()
- if res:
- inv_ids = [x[0] for x in res]
- if len(inv_ids) == 1:
- match = True
- if not match and st_line['communication'] and find_inv_number:
- # check matching invoice number in free form communication combined with matching amount
- free_comm = repl_special(st_line['communication'].strip())
- amount_fmt = '%.' + str(digits) + 'f'
- if st_line['amount'] > 0:
- amount_rounded = amount_fmt % round(st_line['amount'], digits)
- else:
- amount_rounded = amount_fmt % round(-st_line['amount'], digits)
- select = "SELECT id FROM (SELECT id, type, state, amount_total, number, reference_type, reference, " \
- "'%s'::text AS free_comm FROM account_invoice) sq " \
- "WHERE state = 'open' AND amount_total = %s" \
- % (free_comm, amount_rounded)
- # 'out_invoice', 'in_refund'
- if st_line['amount'] > 0:
- select2 = " AND type = 'out_invoice' AND free_comm ilike '%'||number||'%'"
- cr.execute(select + select2)
- res = cr.fetchall()
- if res:
- inv_ids = [x[0] for x in res]
- else:
- select2 = " AND type = 'in_refund' AND free_comm ilike '%'||reference||'%'"
- cr.execute(select + select2)
- res = cr.fetchall()
- if res:
- inv_ids = [x[0] for x in res]
- # 'in_invoice', 'out_refund'
- else:
- select2 = " AND type = 'in_invoice' AND free_comm ilike '%'||reference||'%'"
- cr.execute(select + select2)
- res = cr.fetchall()
- if res:
- inv_ids = [x[0] for x in res]
- else:
- select2 = " AND type = 'out_refund' AND free_comm ilike '%'||number||'%'"
- cr.execute(select + select2)
- res = cr.fetchall()
- if res:
- inv_ids = [x[0] for x in res]
- if inv_ids:
- if len(inv_ids) == 1:
- match = True
- elif len(inv_ids) > 1:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n There are multiple invoices matching the Invoice Amount and Reference." \
- "\n A manual reconciliation is required.") \
- % (st_line['ref'])
-
- if not payment_reference_match and match and inv_ids and len(inv_ids) == 1:
- invoice = inv_obj.browse(cr, uid, inv_ids[0])
- partner = invoice.partner_id
- st_line['partner_id'] = partner.id
- if invoice.type in ['in_invoice', 'in_refund']:
- st_line['account_id'] = partner.property_account_payable.id
- st_line['type'] = 'supplier'
- else:
- st_line['account_id'] = partner.property_account_receivable.id
- st_line['type'] = 'customer'
- iml_ids = move_line_obj.search(cr, uid, [('move_id', '=', invoice.move_id.id), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)])
- if iml_ids:
- st_line['reconcile'] = iml_ids[0]
- else:
- err_string = _('\nThe CODA parsing detected a database inconsistency while processing movement data record 2.3, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R2008'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
-
- # lookup partner via counterparty_number when invoice lookup failed
- if not match and counterparty_number:
- transfer_account = filter(lambda x: counterparty_number in x, company_bank_accounts)
- if transfer_account:
- st_line['account_id'] = transfer_acc
- match = True
- elif find_partner:
- partner_bank_ids = partner_bank_obj.search(cr, uid, [('acc_number', '=', counterparty_number)])
- if not match and find_partner and partner_bank_ids:
- if len(partner_bank_ids) > 1:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n No partner record assigned: There are multiple partners with the same Bank Account Number '%s'!" \
- "\n Please correct the configuration and perform the import again or otherwise change the corresponding entry manually in the generated Bank Statement.") \
- % (st_line['ref'], counterparty_number)
- else:
- partner_bank = partner_bank_obj.browse(cr, uid, partner_bank_ids[0], context)
- st_line['partner_id'] = partner_bank.partner_id.id
- match = True
- if st_line['amount'] < 0:
- st_line['account_id'] = partner_bank.partner_id.property_account_payable.id
- st_line['type'] = 'supplier'
- else:
- st_line['account_id'] = partner_bank.partner_id.property_account_receivable.id
- st_line['type'] = 'customer'
- elif not match and find_partner:
- if counterparty_number:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n The bank account '%s' is not defined for the partner '%s'!" \
- "\n Please correct the configuration and perform the import again or otherwise change the corresponding entry manually in the generated Bank Statement.") \
- % (st_line['ref'], counterparty_number, counterparty_name)
- else:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':" \
- "\n No matching partner record found!" \
- "\n Please adjust the corresponding entry manually in the generated Bank Statement.") \
- % (st_line['ref'])
- st_line['account_id'] = awaiting_acc
-
- # add bank account to partner record
- if match and st_line['account_id'] != transfer_acc and counterparty_number and update_partner:
- partner_bank_ids = partner_bank_obj.search(cr, uid, [('acc_number', '=', counterparty_number), ('partner_id', '=', st_line['partner_id'])], order='id')
- if len(partner_bank_ids) > 1:
- # clean up partner bank duplicates, keep most recently created
- _logger.warn('Duplicate Bank Accounts for partner_id %s have been removed, ids = %s',
- st_line['partner_id'], partner_bank_ids[:-1])
- partner_bank_obj.unlink(cr, uid, partner_bank_ids[:-1])
- if not partner_bank_ids:
- feedback = update_partner_bank(self, cr, uid, st_line['counterparty_bic'], counterparty_number, st_line['partner_id'], counterparty_name)
- if feedback:
- coda_parsing_note += _("\n Bank Statement '%%(name)s' line '%s':") % st_line['ref'] + feedback
-
- coda_statement_lines[st_line_seq] = st_line
- coda_statement['coda_statement_lines'] = coda_statement_lines
- # end of processing movement data record 2.3
-
+ statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:44])
+ statement['lines'][-1]['counterpartyCurrency'] = rmspaces(line[44:47])
+ statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:82])
+ statement['lines'][-1]['communication'] += rmspaces(line[82:125])
else:
- # movement data record 2.x (x <> 1,2,3)
- err_string = _('\nMovement data records of type 2.%s are not supported !') % line[1]
- err_code = 'R2009'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
-
+ # movement data record 2.x (x != 1,2,3)
+ raise osv.except_osv(_('Error R2009!'), _('\nMovement data records of type 2.%s are not supported !') % line[1])
elif line[0] == '3':
- # information data record 3
-
if line[1] == '1':
- # information data record 3.1
- info_line = {}
- info_line['entry_date'] = st_line['entry_date']
- info_line['type'] = 'information'
- st_line_seq = st_line_seq + 1
- info_line['sequence'] = st_line_seq
- info_line['struct_comm_type'] = ''
- info_line['struct_comm_type_desc'] = ''
- info_line['communication'] = ''
- info_line['ref'] = line[2:10]
- info_line['trans_ref'] = line[10:31]
- # positions 32-38 : transaction code
- info_line['trans_type'] = line[31]
- trans_type = filter(lambda x: info_line['trans_type'] == x['type'], trans_type_table)
- if not trans_type:
- err_string = _('\nThe File contains an invalid CODA Transaction Type : %s!') % st_line['trans_type']
- err_code = 'R3001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- info_line['trans_type_desc'] = trans_type[0]['description']
- info_line['trans_family'] = line[32:34]
- trans_family = filter(lambda x: (x['type'] == 'family') and (info_line['trans_family'] == x['code']), trans_code_table)
- if not trans_family:
- err_string = _('\nThe File contains an invalid CODA Transaction Family : %s!') % st_line['trans_family']
- err_code = 'R3002'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- info_line['trans_family_desc'] = trans_family[0]['description']
- info_line['trans_code'] = line[34:36]
- trans_code = filter(lambda x: (x['type'] == 'code') and (info_line['trans_code'] == x['code']) and (trans_family[0]['id'] == x['parent_id'][0]),
- trans_code_table)
- if trans_code:
- info_line['trans_code_desc'] = trans_code[0]['description']
- else:
- info_line['trans_code_desc'] = _('Transaction Code unknown, please consult your bank.')
- info_line['trans_category'] = line[36:39]
- trans_category = filter(lambda x: info_line['trans_category'] == x['category'], trans_category_table)
- if trans_category:
- info_line['trans_category_desc'] = trans_category[0]['description']
- else:
- info_line['trans_category_desc'] = _('Transaction Category unknown, please consult your bank.')
- # positions 40-113 : communication
- if line[39] == '1':
- info_line['struct_comm_type'] = line[40:43]
- comm_type = filter(lambda x: info_line['struct_comm_type'] == x['code'], comm_type_table)
- if not comm_type:
- err_string = _('\nThe File contains an invalid Structured Communication Type : %s!') % info_line['struct_comm_type']
- err_code = 'R3003'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- info_line['struct_comm_type_desc'] = comm_type[0]['description']
- info_line['communication'] = info_line['name'] = line[43:113]
- else:
- info_line['communication'] = info_line['name'] = line[40:113]
- # positions 114-128 not processed
- coda_statement_lines[st_line_seq] = info_line
- coda_statement['coda_statement_lines'] = coda_statement_lines
-
+ infoLine = {}
+ infoLine['entryDate'] = statement['lines'][-1]['entryDate']
+ infoLine['type'] = 'information'
+ infoLine['sequence'] = len(statement['lines']) + 1
+ infoLine['ref'] = rmspaces(line[2:10])
+ infoLine['transactionRef'] = rmspaces(line[10:31])
+ infoLine['transaction_type'] = line[31]
+ infoLine['transaction_family'] = rmspaces(line[32:34])
+ infoLine['transaction_code'] = rmspaces(line[34:36])
+ infoLine['transaction_category'] = rmspaces(line[36:39])
+ infoLine['communication'] = rmspaces(line[40:113])
+ infoLine['amount'] = 0.0
+ infoLine['type'] = 'information'
+ statement['lines'].append(infoLine)
elif line[1] == '2':
- # information data record 3.2
- if coda_statement['coda_statement_lines'][st_line_seq]['ref'] != line[2:10]:
- err_string = _('\nCODA parsing error on information data record 3.2, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R3004'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
- coda_statement['coda_statement_lines'][st_line_seq]['name'] += line[10:115]
- coda_statement['coda_statement_lines'][st_line_seq]['communication'] += line[10:115]
-
+ if infoLine['ref'] != rmspaces(line[2:10]):
+ raise osv.except_osv(_('Error R3004!'), _('CODA parsing error on information data record 3.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ statement['lines'][-1]['communication'] += rmspaces(line[10:100])
elif line[1] == '3':
- # information data record 3.3
- if coda_statement['coda_statement_lines'][st_line_seq]['ref'] != line[2:10]:
- err_string = _('\nCODA parsing error on information data record 3.3, seq nr %s!' \
- '\nPlease report this issue via your OpenERP support channel.') % line[2:10]
- err_code = 'R3005'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Error!'), err_string)
- coda_statement['coda_statement_lines'][st_line_seq]['name'] += line[10:100]
- coda_statement['coda_statement_lines'][st_line_seq]['communication'] += line[10:100]
-
+ if infoLine['ref'] != rmspaces(line[2:10]):
+ raise osv.except_osv(_('Error R3005!'), _('CODA parsing error on information data record 3.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ statement['lines'][-1]['communication'] += rmspaces(line[10:100])
elif line[0] == '4':
- # free communication data record 4
- comm_line = {}
- comm_line['type'] = 'communication'
- st_line_seq = st_line_seq + 1
- comm_line['sequence'] = st_line_seq
- comm_line['ref'] = line[2:10]
- comm_line['communication'] = comm_line['name'] = line[32:112]
- coda_statement_lines[st_line_seq] = comm_line
- coda_statement['coda_statement_lines'] = coda_statement_lines
-
+ comm_line = {}
+ comm_line['type'] = 'communication'
+ comm_line['sequence'] = len(statement['lines']) + 1
+ comm_line['ref'] = rmspaces(line[2:10])
+ comm_line['communication'] = rmspaces(line[32:112])
+ comm_line['amount'] = 0.0
+ comm_line['type'] = 'communication'
+ statement['lines'].append(comm_line)
elif line[0] == '8':
# new balance record
- last_transaction = main_move_stack[-1]
- if last_transaction['type'] == 'globalisation' and not last_transaction.get('detail_cnt'):
- # demote record with globalisation code from 'globalisation' to 'general' when no detail records
- main_st_line_seq = main_move_stack[-1]['sequence']
- to_demote = coda_statement['coda_statement_lines'][main_st_line_seq]
- to_demote.update({
- 'type': 'general',
- 'glob_lvl_flag': 0,
- 'globalisation_amount': False,
- 'amount': main_move_stack[-1]['globalisation_amount'],
- })
- # add closing globalisation level on previous detail record in order to correctly close
- # moves that have been 'promoted' to globalisation
- if main_move_stack[-1].get('detail_cnt') and main_move_stack[-1].get('promoted'):
- closeglobalise = coda_statement['coda_statement_lines'][st_line_seq - 1]
- closeglobalise.update({
- 'glob_lvl_flag': main_move_stack[-1]['glob_lvl_flag'],
- })
- coda_statement['paper_nb_seq_number'] = line[1:4]
- bal_end = list2float(line[42:57])
- coda_statement['new_balance_date'] = str2date(line[57:63])
- if line[41] == '1': # 1=Debit
- bal_end = - bal_end
- coda_statement['balance_end_real'] = bal_end
- if coda_statement['new_balance_date']:
- period_id = period_obj.search(cr, uid, [('date_start', '<=', coda_statement['new_balance_date']), ('date_stop', '>=', coda_statement['new_balance_date'])])
+ statement['debit'] = line[41]
+ statement['paperSeqNumber'] = rmspaces(line[1:4])
+ statement['balance_end_real'] = float(rmspaces(line[42:57])) / 1000
+ statement['balance_end_realDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[57:63]), '%d%m%y'))
+ if statement['debit'] == '1': # 1=Debit
+ statement['balance_end_real'] = - statement['balance_end_real']
+ if statement['balance_end_realDate']:
+ period_id = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', statement['balance_end_realDate']), ('date_stop', '>=', statement['balance_end_realDate'])])
else:
- period_id = period_obj.search(cr, uid, [('date_start', '<=', coda_statement['date']), ('date_stop', '>=', coda_statement['date'])])
- if not period_id:
- err_string = _("\nThe CODA Statement New Balance date doesn't fall within a defined Accounting Period!" \
- "\nPlease create the Accounting Period for date %s.") % coda_statement['new_balance_date']
- err_code = 'R0002'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('Data Error!'), err_string)
- coda_statement['period_id'] = period_id[0]
- if coda_bank['coda_st_naming']:
- coda_statement['name'] = coda_bank['coda_st_naming'] % {
- 'code': coda_bank['journal_code'] or '',
- 'year': coda_statement['new_balance_date'] and coda_statement['new_balance_date'][:4] or coda_statement['date'][:4],
- 'y': coda_statement['new_balance_date'] and coda_statement['new_balance_date'][2:4] or coda_statement['date'][2:4],
- 'coda': coda_statement['coda_seq_number'],
- 'paper_ob': coda_statement['paper_ob_seq_number'],
- 'paper': coda_statement['paper_nb_seq_number'],
- }
- else:
- coda_statement['name'] = '/'
-
+ period_id = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', statement['date']), ('date_stop', '>=', statement['date'])])
+ if not period_id and len(period_id) == 0:
+ raise osv.except_osv(_('Error R0002!'), _("The CODA Statement New Balance date doesn't fall within a defined Accounting Period! Please create the Accounting Period for date %s.") % statement['balance_end_realDate'])
+ statement['period_id'] = period_id[0]
elif line[0] == '9':
- # footer record
- coda_statement['balance_min'] = list2float(line[22:37])
- coda_statement['balance_plus'] = list2float(line[37:52])
- if not bal_end:
- coda_statement['balance_end_real'] = coda_statement['balance_start'] + coda_statement['balance_plus'] - coda_statement['balance_min']
- if coda_parsing_note:
- coda_statement['coda_parsing_note'] = '\nStatement Line matching results:' + coda_parsing_note
- else:
- coda_statement['coda_parsing_note'] = ''
- coda_statements.append(coda_statement)
- #end for
+ statement['balanceMin'] = float(rmspaces(line[22:37])) / 1000
+ statement['balancePlus'] = float(rmspaces(line[37:52])) / 1000
+ if not statement['balance_end_real']:
+ statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
+ for i, statement in enumerate(statements):
+ # print '---STATEMENT #' + str(i) + '---'
+ print statement
+ data = {
+ 'name': '[' + statement['date'] + ']' + statement['description'],
+ 'date': statement['date'],
+ 'journal_id': 18,
+ 'period_id': statement['period_id'],
+ 'balance_start': statement['balance_start'],
+ 'balance_end_real': statement['balance_end_real'],
+ 'account_id': 1
+ }
+ statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
+ for line in statement['lines']:
+ if line['type'] == 'normal':
+ counterparty = []
+ if 'counterpartyName' in line:
+ counterparty.append(line['counterpartyName'])
+ if 'counterpartyNumber' in line:
+ counterparty.append(line['counterpartyNumber'])
+ if len(counterparty) > 0:
+ counterparty = '[' + ' / '.join(counterparty) + ']'
+ else:
+ counterparty = '/'
+ if line['transaction_type'] in transaction_types:
+ line['transaction_type'] = transaction_types[line['transaction_type']][1]
+ if line['transaction_category'] in transaction_categories:
+ line['transaction_category'] = transaction_categories[line['transaction_category']]
+ if line['transaction_family'] in transaction_codes:
+ transaction_family = transaction_codes[line['transaction_family']]
+ line['transaction_family'] = transaction_family[0]
+ if line['transaction_code'] in transaction_family[1]:
+ line['transaction_code'] = transaction_family[1][line['transaction_code']]
+ note = []
+ note.append(_('Counter Party') + ': ' + counterparty)
+ note.append(_('Communication') + ': ' + line['communication'])
+ note.append(_('Transaction type') + ': ' + line['transaction_type'])
+ note.append(_('Transaction family') + ': ' + line['transaction_family'])
+ note.append(_('Transaction code') + ': ' + line['transaction_code'])
+ note.append(_('Transaction category') + ': ' + line['transaction_category'])
- err_string = ''
- err_code = ''
- coda_id = 0
- coda_note = ''
- line_note = ''
-
- try:
- coda_id = coda_obj.create(cr, uid, {
- 'name': codafilename,
- 'coda_data': codafile,
- 'coda_creation_date': coda_statement['date'],
- 'date': fields.date.context_today(self, cr, uid, context=context),
- 'user_id': uid,
- })
- context.update({'coda_id': coda_id})
-
- except osv.except_osv, e:
- cr.rollback()
- err_string = _('\nApplication Error : ') + str(e)
- except Exception, e:
- cr.rollback()
- err_string = _('\nSystem Error : ') + str(e)
- except:
- cr.rollback()
- err_string = _('\nUnknown Error : ') + str(e)
- if err_string:
- err_code = 'G0001'
- if batch:
- return (err_code, err_string)
- raise osv.except_osv(_('CODA Import failed !'), err_string)
-
- nb_err = 0
- err_string = ''
- coda_st_ids = []
- bk_st_ids = []
-
- for statement in coda_statements:
-
- # The CODA Statement info is written to two objects: 'coda.bank.statement' and 'account.bank.statement'
-
- try:
- normal2info = False
- lines = statement['coda_statement_lines']
- if not statement['first_transaction_date']:
- normal2info = True # don't create a bank statement for CODA's without transactions
- else:
- line_vals = [x for x in lines.itervalues()]
- transactions = filter(lambda x: (x['type'] in ['globalisation', 'general', 'supplier', 'customer']) and x['amount'], line_vals)
- if not transactions:
- normal2info = True # don't create a bank statement for CODA's without transactions
- if normal2info:
- statement['type'] = 'info' # don't create a bank statement for CODA's without transactions
- statement['coda_parsing_note'] += _("\n\nThe CODA Statement %s does not contain transactions, hence no Bank Statement has been created." \
- "\nSelect the 'CODA Bank Statement' to check the contents of %s.") \
- % (statement['name'], statement['name'])
-
- coda_st_id = coda_st_obj.create(cr, uid, {
- 'name': statement['name'],
- 'type': statement['type'],
- 'coda_bank_account_id': statement['coda_bank_account_id'],
- 'currency': statement['currency_id'],
- 'journal_id': statement['journal_id'],
- 'coda_id': coda_id,
- 'date': statement['date'],
- 'coda_creation_date': statement['coda_creation_date'],
- 'period_id': statement['period_id'],
- 'old_balance_date': statement['old_balance_date'],
- 'new_balance_date': statement['new_balance_date'],
- 'balance_start': statement['balance_start'],
- 'balance_end_real': statement['balance_end_real'],
- })
- coda_st_ids.append(coda_st_id)
-
- # check duplicates for CODA's of type 'normal'
- discard = False
- if statement['type'] == 'normal' and statement['discard_dup']:
- dup_ids = bank_st_obj.search(cr, uid, [('name', '=', statement['name']), ('company_id', '=', company_id)])
- if dup_ids:
- discard = True
- statement['type'] = 'info' # don't create a bank statement for duplicates
- statement['coda_parsing_note'] += _("\n\nThe Bank Statement %s already exists, hence no duplicate Bank Statement has been created." \
- "\nSelect the 'CODA Bank Statement' to check the contents of %s.") \
- % (statement['name'], statement['name'])
-
- # create only bank statement for CODA's of type 'normal'
- if statement['type'] == 'normal' and not discard:
- context.update({'ebanking_import': 1})
- journal = journal_obj.browse(cr, uid, statement['journal_id'], context=context)
- balance_start_check_date = statement['first_transaction_date'] or statement['date']
- cr.execute('SELECT balance_end_real \
- FROM account_bank_statement \
- WHERE journal_id = %s and date <= %s \
- ORDER BY date DESC,id DESC LIMIT 1', (statement['journal_id'], balance_start_check_date))
- res = cr.fetchone()
- balance_start_check = res and res[0]
- if balance_start_check == None:
- if journal.default_debit_account_id and (journal.default_credit_account_id == journal.default_debit_account_id):
- balance_start_check = journal.default_debit_account_id.balance
+ try:
+ if 'counterpartyNumber' in line and int(line['counterpartyNumber']) == 0:
+ line['counterpartyNumber'] = False
+ except:
+ pass
+ if 'counterpartyNumber' in line and line['counterpartyNumber']:
+ ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
+ if ids and len(ids) > 0:
+ partner_id = self.pool.get('res.partner.bank').browse(cr, uid, ids[0],context=context).partner_id.id
else:
- nb_err += 1
- err_string += _('\nConfiguration Error in journal %s!' \
- '\nPlease verify the Default Debit and Credit Account settings.') % journal.name
- break
- if balance_start_check != statement['balance_start']:
- balance_start_err_string = _('\nThe CODA Statement %s Starting Balance (%.2f) does not correspond with the previous Closing Balance (%.2f) in journal %s!') \
- % (statement['name'], statement['balance_start'], balance_start_check, journal.name)
- if statement['balance_start_enforce']:
- nb_err += 1
- err_string += balance_start_err_string
- break
- else:
- statement['coda_parsing_note'] += '\n' + balance_start_err_string
+ partner_id = None
- st_vals = {
- 'name': statement['name'],
- 'journal_id': statement['journal_id'],
- 'coda_statement_id': coda_st_id,
- 'date': statement['new_balance_date'],
- 'period_id': statement['period_id'],
- 'balance_start': statement['balance_start'],
- 'balance_end_real': statement['balance_end_real'],
- 'state': 'draft',
+ data = {
+ 'name': line['communication'],
+ 'note': "\n".join(note),
+ 'date': line['entryDate'],
+ 'amount': line['amount'],
+ # 'type': '',
+ 'partner_id': partner_id,
+ 'account_id': 1,
+ 'statement_id': statement['id'],
+ # 'analytic_account_id': '',
+ # 'move_ids': '',
+ 'ref': line['ref'],
+ 'sequence': line['sequence'],
}
- st_hook_error, st_vals = self._statement_hook(cr, uid, statement['coda_bank_params'], st_vals, context=context)
- if st_hook_error:
- nb_err += 1
- err_string += st_hook_error
- break
- bk_st_id = bank_st_obj.create(cr, uid, st_vals, context=context)
- bk_st_ids.append(bk_st_id)
- coda_st_obj.write(cr, uid, [coda_st_id], {'statement_id': bk_st_id}, context=context)
-
- st_line_seq = 0
-
- for x in lines:
- line = lines[x]
-
- if not line['type'] == 'communication':
- if line['trans_family'] in st_line_name_families:
- line['name'] = get_st_line_name(line, context)
- if line['type'] == 'information':
- if line['struct_comm_type'] in parse_comms_info:
- line['name'], line['communication'] = parse_comm_info(self, cr, uid, line, comm_type_table, context)
- elif line['struct_comm_type'] in parse_comms_move:
- line['name'], line['communication'] = parse_comm_move(self, cr, uid, line, comm_type_table, context)
- elif line['struct_comm_type'] in parse_comms_move:
- line['name'], line['communication'] = parse_comm_move(self, cr, uid, line, comm_type_table, context)
-
- # handling non-transactional records : line['type'] in ['information', 'communication']
-
- if line['type'] == 'information':
-
-
- #Check if this line can be deleted. glob_id_stack marked as undefined here
- line['globalisation_id'] = glob_id_stack[-1][2]
- line_note = _('Transaction Type' ': %s - %s' \
- '\nTransaction Family: %s - %s' \
- '\nTransaction Code: %s - %s' \
- '\nTransaction Category: %s - %s' \
- '\nStructured Communication Type: %s - %s' \
- '\nCommunication: %s') \
- % (line['trans_type'], line['trans_type_desc'],
- line['trans_family'], line['trans_family_desc'],
- line['trans_code'], line['trans_code_desc'],
- line['trans_category'], line['trans_category_desc'],
- line['struct_comm_type'], line['struct_comm_type_desc'],
- line['communication'])
-
- coda_st_line_obj.create(cr, uid, {
- 'sequence': line['sequence'],
- 'ref': line['ref'],
- 'name': line['name'].strip() or '/',
- 'type': 'information',
- 'date': line['entry_date'],
- 'statement_id': coda_st_id,
- 'note': line_note,
- })
-
- elif line['type'] == 'communication':
-
- line_note = _('Free Communication:\n %s') \
- % (line['communication'])
-
- coda_st_line_obj.create(cr, uid, {
- 'sequence': line['sequence'],
- 'ref': line['ref'],
- 'name': line['name'].strip() or '/',
- 'type': 'communication',
- 'date': statement['date'],
- 'statement_id': coda_st_id,
- 'note': line_note,
- })
-
- # handling transactional records, # line['type'] in ['globalisation', 'general', 'supplier', 'customer']
-
- else:
-
- if line['ref_move_detail'] == '0000':
- glob_id_stack = [(0, '', 0, '')] # initialise stack with tuples (glob_lvl_flag, glob_code, glob_id, glob_name)
-
- glob_lvl_flag = line['glob_lvl_flag']
- if glob_lvl_flag:
- if glob_id_stack[-1][0] == glob_lvl_flag:
- line['globalisation_id'] = glob_id_stack[-1][2]
- glob_id_stack.pop()
- else:
- glob_name = line['name'].strip() or '/'
- glob_code = seq_obj.get(cr, uid, 'statement.line.global')
- glob_id = glob_obj.create(cr, uid, {
- 'code': glob_code,
- 'name': glob_name,
- 'type': 'coda',
- 'parent_id': glob_id_stack[-1][2],
- 'amount': line['globalisation_amount'],
- })
- line['globalisation_id'] = glob_id
- glob_id_stack.append((glob_lvl_flag, glob_code, glob_id, glob_name))
-
- line_note = _('Partner Name: %s \nPartner Account Number: %s' \
- '\nTransaction Type: %s - %s' \
- '\nTransaction Family: %s - %s' \
- '\nTransaction Code: %s - %s' \
- '\nTransaction Category: %s - %s' \
- '\nStructured Communication Type: %s - %s' \
- '\nPayment Reference: %s' \
- '\nCommunication: %s') \
- % (line['counterparty_name'], line['counterparty_number'],
- line['trans_type'], line['trans_type_desc'],
- line['trans_family'], line['trans_family_desc'],
- line['trans_code'], line['trans_code_desc'],
- line['trans_category'], line['trans_category_desc'],
- line['struct_comm_type'], line['struct_comm_type_desc'],
- line['payment_reference'],
- line['communication'])
-
- if line['type'] == 'globalisation':
-
- coda_st_line_obj.create(cr, uid, {
- 'sequence': line['sequence'],
- 'ref': line['ref'],
- 'name': line['name'].strip() or '/',
- 'type': 'globalisation',
- 'val_date': line['val_date'],
- 'date': line['entry_date'],
- 'globalisation_level': line['glob_lvl_flag'],
- 'globalisation_amount': line['globalisation_amount'],
- 'globalisation_id': line['globalisation_id'],
- 'partner_id': line['partner_id'] or 0,
- 'account_id': line['account_id'],
- 'payment_reference': line['payment_reference'],
- 'statement_id': coda_st_id,
- 'note': line_note,
- })
-
- else: # line['type'] in ['general', 'supplier', 'customer']
-
- if glob_lvl_flag == 0:
- line['globalisation_id'] = glob_id_stack[-1][2]
- if not line['account_id']:
- line['account_id'] = awaiting_acc
-
- coda_st_line_obj.create(cr, uid, {
- 'sequence': line['sequence'],
- 'ref': line['ref'],
- 'name': line['name'].strip() or '/',
- 'type': line['type'],
- 'val_date': line['val_date'],
- 'date': line['entry_date'],
- 'amount': line['amount'],
- 'partner_id': line['partner_id'] or 0,
- 'counterparty_name': line['counterparty_name'],
- 'counterparty_bic': line['counterparty_bic'],
- 'counterparty_number': line['counterparty_number'],
- 'counterparty_currency': line['counterparty_currency'],
- 'account_id': line['account_id'],
- 'globalisation_level': line['glob_lvl_flag'],
- 'globalisation_id': line['globalisation_id'],
- 'payment_reference': line['payment_reference'],
- 'statement_id': coda_st_id,
- 'note': line_note,
- })
-
- if statement['type'] == 'normal':
- if line['amount'] != 0.0:
- st_line_seq += 1
- voucher_id = False
- line_name = line['name'].strip()
- if not line_name:
- if line['globalisation_id']:
- line_name = glob_id_stack[-1][3] or '/'
- else:
- line_name = '/'
-
- if line['reconcile']:
-
- move_line = move_line_obj.browse(cr, uid, line['reconcile'], context=context)
- company_currency_id = journal.company_id.currency_id.id
- currency_id = journal.currency.id
- if currency_id and currency_id != company_currency_id:
- multi_currency = True
- else:
- multi_currency = False
- context_multi_currency = context.copy()
- context_multi_currency.update({'date': line['entry_date']})
-
- line_cr_ids = []
- line_dr_ids = []
- amount_remaining = abs(line['amount'])
-
- #for entry in entries:
- if move_line.reconcile_partial_id:
- amount_original = abs(move_line.amount_residual_currency)
- else:
- amount_original = move_line.credit or move_line.debit
- if multi_currency:
- if move_line.currency_id and move_line.amount_currency:
- amount_original = abs(move_line.amount_currency)
- else:
- amount_original = currency_obj.compute(cr, uid, company_currency_id, currency_id, amount_original, context=context_multi_currency)
- if amount_remaining > 0:
- amount_voucher_line = min(amount_original, abs(amount_remaining))
- amount_remaining -= amount_voucher_line
- else:
- amount_voucher_line = 0.0
- voucher_line_vals = {
- 'name': move_line.name,
- 'account_id': move_line.account_id.id,
- 'amount': amount_voucher_line,
- 'reconcile': amount_voucher_line == amount_original,
- 'type': move_line.credit and 'dr' or 'cr',
- 'move_line_id': move_line.id,
- }
- if voucher_line_vals['type'] == 'cr':
- line_cr_ids += [(0, 0, voucher_line_vals)]
- else:
- line_dr_ids += [(0, 0, voucher_line_vals)]
-
- voucher_vals = {
- 'type': line['type'] == 'supplier' and 'payment' or 'receipt',
- 'name': line_name,
- 'date': line['val_date'],
- 'journal_id': statement['journal_id'],
- 'account_id': journal.default_credit_account_id.id,
- 'line_cr_ids': line_cr_ids,
- 'line_dr_ids': line_dr_ids,
- 'pre_line': len(line_dr_ids) > 0 and True or False,
- 'period_id': statement['period_id'],
- 'currency_id': journal.currency and journal.currency.id or journal.company_id.currency_id.id,
- 'company_id': journal.company_id.id,
- 'state': 'draft',
- 'amount': abs(line['amount']),
- 'reference': line['ref'],
- 'number': statement['name'] + '/' + str(st_line_seq),
- 'partner_id': line['partner_id'],
- }
-
- #_logger.warn('voucher_vals=%s, context=%s', voucher_vals, context)
- context['journal_id'] = journal.id # add journal to context for __get_payment_rate_currency method
- if line_cr_ids or line_dr_ids:
- voucher_id = voucher_obj.create(cr, uid, voucher_vals, context=context)
- else:
- raise osv.except_osv(_('Error!'), _("Reconcile error while processing line with ref '%s' ! " \
- "\nPlease report this issue via your OpenERP support channel.") % line['ref'])
-
- # override default account mapping by mappings defined in rules engine
- if statement['account_mapping_ids']:
- kwargs = {
- 'coda_bank_account_id': statement['coda_bank_account_id'],
- 'trans_type_id': line['trans_type_id'],
- 'trans_family_id': line['trans_family_id'],
- 'trans_code_id': line['trans_code_id'],
- 'trans_category_id': line['trans_category_id'],
- 'struct_comm_type_id': line['struct_comm_type_id'],
- 'partner_id': line['partner_id'],
- 'context': context,
- }
- account_id = account_mapping_obj.account_id_get(cr, uid, **kwargs)
- if account_id:
- line['account_id'] = account_id
- st_line_vals = {
- 'ref': line['ref'],
- 'name': line_name,
- 'type': line['type'],
- 'val_date': line['val_date'],
- 'date': line['entry_date'],
- 'amount': line['amount'],
- 'partner_id': line['partner_id'] or 0,
- 'counterparty_name': line['counterparty_name'],
- 'counterparty_bic': line['counterparty_bic'],
- 'counterparty_number': line['counterparty_number'],
- 'counterparty_currency': line['counterparty_currency'],
- 'account_id': line['account_id'],
- 'globalisation_id': line['globalisation_id'],
- 'statement_id': bk_st_id,
- 'voucher_id': voucher_id,
- 'note': line_note,
- }
-
- st_lines_vals = self._st_line_hook(cr, uid, statement['coda_bank_params'], st_line_vals, context=context)
- if not st_lines_vals:
- # removal of lines by the _coda_parsing_hook currently not supported :
- # this qould require resequencing/renaming of linked vouchers & moves as well as removal of associated voucher/moves
- err_string += _('\nError in _st_line_hook while processing CODA Statement %s for Bank Account %s!') \
- % (statement['coda_seq_number'], (statement['acc_number'] + ' (' + statement['currency'] + ') - ' + statement['description']))
- nb_err += 1
- for st_line_vals in st_lines_vals:
- # To DO : update sequence of statement lines and naming of associated vouchers/moves when the hook returns multiple lines
- st_line_vals.update({'sequence': st_line_seq})
- bank_st_line_obj.create(cr, uid, st_line_vals, context=context)
- if st_line_vals['voucher_id']:
- voucher = voucher_obj.browse(cr, uid, st_line_vals['voucher_id'], context=context)
- move_line = move_line_obj.browse(cr, uid, line['reconcile'], context=context)
- if line['amount'] == (line['amount'] > 0 and move_line.debit or -move_line.credit):
- wf_service.trg_validate(uid, 'account.voucher', st_line_vals['voucher_id'], 'proforma_voucher', cr)
- if voucher.move_id:
- move_line_obj.write(cr, uid, [x.id for x in voucher.move_ids], {'statement_id': bk_st_id}, context=context)
-
- # end 'for x in lines'
-
- coda_st_obj.write(cr, uid, [coda_st_id], {}, context=context) # calculate balance
- st_balance = coda_st_obj.read(cr, uid, coda_st_id, ['balance_end', 'balance_end_real'], context=context)
- if st_balance['balance_end'] != st_balance['balance_end_real']:
- err_string += _('\nIncorrect ending Balance in CODA Statement %s for Bank Account %s!') \
- % (statement['coda_seq_number'], (statement['acc_number'] + ' (' + statement['currency'] + ') - ' + statement['description']))
- if statement['type'] == 'normal':
- nb_err += 1
- break
- else:
- statement['coda_parsing_note'] += '\n' + err_string
-
- if statement['type'] == 'normal':
- bank_st_obj.button_dummy(cr, uid, [bk_st_id], context=context) # calculate balance
- journal_name = journal.name
- else:
- journal_name = _('None')
- coda_note = coda_note + \
- _('\n\nBank Journal: %s' \
- '\nCODA Version: %s' \
- '\nCODA Sequence Number: %s' \
- '\nPaper Statement Sequence Number: %s' \
- '\nBank Account: %s' \
- '\nAccount Holder Name: %s' \
- '\nDate: %s, Starting Balance: %.2f, Ending Balance: %.2f' \
- '%s') \
- % (journal_name,
- coda_version,
- statement['coda_seq_number'],
- statement['paper_nb_seq_number'],
- (statement['acc_number'] + ' (' + statement['currency'] + ') - ' + statement['description']),
- statement['acc_holder'],
- statement['date'], float(statement['balance_start']), float(statement['balance_end_real']),
- statement['coda_parsing_note'] % {'name': coda_statement['name']})
- if statement.get('separate_application') != '00000':
- coda_note += _('\nCode Separate Application: %s') % statement['separate_application'] \
-
- except osv.except_osv, e:
- cr.rollback()
- nb_err += 1
- err_string += _('\nError ! ') + str(e)
- tb = ''.join(format_exception(*exc_info()))
- _logger.error('Application Error while processing Statement %s\n%s',
- statement.get('name', '/'), tb)
- except Exception, e:
- cr.rollback()
- nb_err += 1
- err_string += _('\nSystem Error : ') + str(e)
- tb = ''.join(format_exception(*exc_info()))
- _logger.error('System Error while processing Statement %s\n%s',
- statement.get('name', '/'), tb)
- except:
- cr.rollback()
- nb_err += 1
- err_string = _('\nUnknown Error : ') + str(e)
- tb = ''.join(format_exception(*exc_info()))
- _logger.error('Unknown Error while processing Statement %s\n%s',
- statement.get('name', '/'), tb)
-
- # end 'for statement in coda_statements'
-
- coda_note_header = _('CODA File is Imported :')
- coda_note_footer = _('\n\nNumber of statements : ') + str(len(coda_st_ids))
- err_log = err_log + _('\nNumber of errors : ') + str(nb_err) + '\n'
-
- if not nb_err:
- note = coda_note_header + coda_note + coda_note_footer
- coda_obj.write(cr, uid, [coda_id], {'note': note})
- cr.commit()
- if batch:
- return None
- else:
- cr.rollback()
- if batch:
- err_code = 'G0002'
- return (err_code, err_string)
- raise osv.except_osv(_('CODA Import failed !'), err_string)
-
- context.update({'bk_st_ids': bk_st_ids})
- model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'account_coda_import_result_view')], context=context)
- resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- self.write(cr, uid, ids, {'note': note}, context=context)
-
- return {
- 'name': _('Import CODA File result'),
- 'res_id': ids[0],
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'account.coda.import',
- 'view_id': False,
- 'target': 'new',
- 'views': [(resource_id, 'form')],
- 'context': context,
- 'type': 'ir.actions.act_window',
- }
-
- def _statement_hook(self, cr, uid, coda_bank_params, st_vals, context=None):
- """
- Use this method to take customer specific actions based upon the bank statement data.
- Returns:
- st_hook_error : False or string with error message
- st_vals
- """
- return False, st_vals
-
- def _st_line_hook(self, cr, uid, coda_bank_params, st_line_vals, context=None):
- """
- Use this method to adapt the statement line created by the
- CODA parsing to customer specific needs.
- """
- print 'PLZ DISPLAY SOMETHING RIGHTPLZPLZPLZ'
- print st_line_vals['name']
- print st_line_vals['counterparty_name']
- return [st_line_vals]
-
- def action_open_coda_statements(self, cr, uid, ids, context=None):
- if context is None:
- context = {}
- module, xml_id = 'l10n_be_coda', 'action_coda_bank_statements'
- res_model, res_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, xml_id)
- action = self.pool.get('ir.actions.act_window').read(cr, uid, res_id, context=context)
- domain = eval(action.get('domain') or '[]')
- domain += [('coda_id', '=', context.get('coda_id', False))]
- action.update({'domain': domain})
- return action
-
- def action_open_bank_statements(self, cr, uid, ids, context=None):
- if context is None:
- context = {}
- module, xml_id = 'account', 'action_bank_statement_tree'
- res_model, res_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, xml_id)
- action = self.pool.get('ir.actions.act_window').read(cr, uid, res_id, context=context)
- domain = eval(action.get('domain') or '[]')
- domain += [('id', 'in', context.get('bk_st_ids', False))]
- action.update({'domain': domain})
- return action
+ self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
account_coda_import()
+transaction_types = {
+ "0": ["", _("Simple amount without detailed data; e.g. : an individual credit transfer [free of charges].")],
+ "1": ["", _("Amount as totalised by the customer; e.g. a file regrouping payments of wages or payments made to suppliers or a file regrouping collections for which the customer is ]debited or credited with one single amount. As a matter of principle, this type is also used when no detailed data is following [type 5].")],
+ "5": ["1", _("Detail of 1. Standard procedure is no detailing. However, the customer may ask for detailed data to be included into his file after the overall record [type 1].")],
+ "2": ["", _("Amount as totalised by the bank; e.g. : the total amount of a series of credit transfers with a structured communication As a matter of principle, this type will also be used when no detailed data [type 6 or 7] is following.")],
+ "6": ["2", _("Detail of 2. Simple amount without detailed data. Normally, data of this kind comes after type 2. The customer may ask for a separate file containing the detailed data. In that case, one will speak of a ‘separate application’. The records in a separate application keep type 6.")],
+ "7": ["2", _("Detail of 2. Simple account with detailed data The records in a separate application keep type 7.")],
+ "9": ["7", _("Detail of 7. The records in a separate application keep type 9.")],
+ "3": ["", _("Simple amount with detailed data; e.g. in case of charges for cross-border credit transfers.")],
+ "8": ["3", _("Detail of 3.")],
+}
-def repl_special(s):
- s = s.replace("\'", "\'" + "'")
- return s
+transaction_codes = {
+ "00": [_("Undefined transactions"), {
+ "89": _("Cancellation of a transaction"),
+ "87": _("Costs refunded"),
+ "85": _("Correction"),
+ "83": _("Value correction"),
+ "39": _("Cancellation of a transaction"),
+ "37": _("Costs"),
+ "35": _("Correction"),
+ "33": _("Value correction"),
+ "00": _("Undefined transaction")
+ }],
+ "01": [_("Domestic or local SEPA credit transfers"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "66": _("Financial centralization"),
+ "64": _("Transfer to your account"),
+ "62": _("Unpaid postal order"),
+ "60": _("Non-presented circular cheque"),
+ "54": _("Unexecutable transfer order"),
+ "52": _("Payment in your favour"),
+ "51": _("Transfer in your favour – initiated by the bank"),
+ "50": _("Transfer in your favour"),
+ "49": _("Cancellation or correction"),
+ "39": _("Your issue circular cheque"),
+ "37": _("Costs"),
+ "17": _("Financial centralisation"),
+ "15": _("Balance due insurance premium"),
+ "13": _("Transfer from your account"),
+ "11": _("Your semi-standing order – payment to employees"),
+ "09": _("Your semi-standing order"),
+ "07": _("Collective transfer"),
+ "05": _("Payment of wages etc."),
+ "03": _("Standing order"),
+ "02": _("Individual transfer order initiated by the bank"),
+ "01": _("Individual transfer order]"),
+ }],
+ "03": [_("Cheques"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of cheque-related costs"),
+ "68": _("Credit of a payment via electronic purse"),
+ "66": _("Remittance of cheque by your branch - credit under usual reserve"),
+ "64": _("Reversal of settlement of credit card"),
+ "63": _("Second credit of unpaid cheque"),
+ "62": _("Reversal of cheque"),
+ "60": _("Reversal of voucher"),
+ "58": _("Remittance of cheques, vouchers, etc. credit after collection"),
+ "56": _("Non-presented certified cheques"),
+ "52": _("First credit of cheques, vouchers, luncheon vouchers, postal orders, credit under usual reserve"),
+ "50": _("Credit of a payment via terminal"),
+ "49": _("Cancellation or correction"),
+ "39": _("Provisionally unpaid due to other reason than manual presentation"),
+ "38": _("Provisionally unpaid"),
+ "37": _("Cheque-related costs"),
+ "35": _("Cash advance"),
+ "19": _("Settlement of credit cards"),
+ "17": _("Your certified cheque"),
+ "15": _("Your purchase bank cheque"),
+ "13": _("Eurocheque written out abroad"),
+ "11": _("Department store cheque"),
+ "09": _("Unpaid voucher"),
+ "07": _("Definitely unpaid cheque"),
+ "05": _("Payment of voucher"),
+ "03": _("Your purchase by payment card"),
+ "01": _("Payment of your cheque"),
+ }],
+ "04": [_("Cards"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "68": _("Credit after Proton payments"),
+ "55": _("Income from payments by GSM"),
+ "53": _("Cash deposit at an ATM"),
+ "52": _("Loading GSM cards"),
+ "51": _("Unloading Proton"),
+ "50": _("Credit after a payment at a terminal"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs"),
+ "08": _("Payment by means of a payment card outside the Eurozone"),
+ "07": _("Payment by GSM"),
+ "06": _("Payment with tank card"),
+ "05": _("Loading Proton"),
+ "04": _("Cash withdrawal from an ATM"),
+ "03": _("Settlement credit cards"),
+ "02": _("Payment by means of a payment card within the Eurozone"),
+ "01": _("Loading a GSM card"),
+ }],
+ "05": [_("Direct debit"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "58": _("Reversal"),
+ "56": _("Unexecutable reimbursement"),
+ "54": _("Reimbursement"),
+ "52": _("Credit under usual reserve"),
+ "50": _("Credit after collection"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs"),
+ "05": _("Reimbursement"),
+ "03": _("Unpaid debt"),
+ "01": _("Payment"),
+ }],
+ "07": [_("Domestic commercial paper"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "86": _("Payment after cession"),
+ "64": _("Warrant"),
+ "58": _("Remittance of supplier's bill without guarantee"),
+ "56": _("Remittance of supplier's bill with guarantee"),
+ "54": _("Remittance of commercial paper for discount"),
+ "52": _("Remittance of commercial paper - credit under usual reserve"),
+ "50": _("Remittance of commercial paper - credit after collection"),
+ "49": _("Cancellation or correction"),
+ "39": _("Return of an irregular bill of exchange"),
+ "37": _("Costs related to commercial paper"),
+ "14": _("Warrant fallen due"),
+ "12": _("Safe custody"),
+ "10": _("Renewal of agreed maturity date"),
+ "09": _("Agio on supplier's bill"),
+ "08": _("Payment in advance"),
+ "07": _("Unpaid commercial paper"),
+ "06": _("Extension of maturity date"),
+ "05": _("Commercial paper claimed back"),
+ "03": _("Payment receipt card"),
+ "01": _("Payment commercial paper"),
+ }],
+ "09": [_("Counter transactions"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "70": _("Sale of traveller’s cheque"),
+ "68": _("Difference in payment"),
+ "66": _("Repurchase of petrol coupons"),
+ "64": _("Your winning lottery ticket"),
+ "62": _("Sale of gold/pieces under usual reserve"),
+ "60": _("Sale of foreign bank notes"),
+ "58": _("Payment by your branch/agents"),
+ "56": _("Reserve"),
+ "54": _("Your payment ATM"),
+ "52": _("Payment night safe"),
+ "50": _("Cash payment"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs"),
+ "25": _("Purchase of traveller’s cheque"),
+ "21": _("Cash withdrawal on card (PROTON)"),
+ "19": _("Difference in payment"),
+ "17": _("Purchase of fiscal stamps"),
+ "15": _("Your purchase of lottery tickets"),
+ "13": _("Cash withdrawal by your branch or agents"),
+ "11": _("Your purchase of luncheon vouchers"),
+ "09": _("Purchase of petrol coupons"),
+ "07": _("Purchase of gold/pieces"),
+ "05": _("Purchase of foreign bank notes"),
+ "03": _("Cash withdrawal by card (ATM)"),
+ "01": _("Cash withdrawal"),
+ }],
+ "11": [_("Securities"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "70": _("Settlement of securities"),
+ "68": _("Compensation for missing coupon"),
+ "66": _("Retrocession of issue commission"),
+ "64": _("Your issue"),
+ "62": _("Interim interest on subscription"),
+ "58": _("Repayable securities from a deposit or delivered at the counter - credit under usual reserve"),
+ "56": _("Reserve"),
+ "52": _("Payment of coupons from a deposit or settlement of coupons delivered over the counter - credit under usual reserve"),
+ "51": _("Tender"),
+ "50": _("Sale of securities"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs"),
+ "19": _("Regularisation costs"),
+ "17": _("Management fee"),
+ "15": _("Interim interest on subscription"),
+ "13": _("Your repurchase of issue"),
+ "11": _("Payable coupons/repayable securities"),
+ "09": _("Settlement of securities"),
+ "06": _("Share option plan – exercising an option"),
+ "05": _("Partial payment subscription"),
+ "04": _("Issues"),
+ "03": _("Subscription to securities"),
+ "02": _("Tenders"),
+ "01": _("Purchase of securities"),
+ }],
+ "13": [_("Credit"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "70": _("Settlement of discount bank acceptance"),
+ "68": _("Documentary export credits"),
+ "62": _("Term loan"),
+ "60": _("Settlement of mortgage loan"),
+ "56": _("Subsidy"),
+ "55": _("Fixed advance – interest only"),
+ "54": _("Fixed advance – capital and interest"),
+ "50": _("Settlement of instalment credit"),
+ "49": _("Cancellation or correction"),
+ "37": _("Credit-related costs"),
+ "21": _("Other credit applications"),
+ "19": _("Documentary import credits"),
+ "15": _("Your repayment hire-purchase and similar claims"),
+ "13": _("Settlement of bank acceptances"),
+ "11": _("Your repayment mortgage loan"),
+ "07": _("Your repayment instalment credits"),
+ "05": _("Settlement of fixed advance"),
+ "02": _("Long-term loan"),
+ "01": _("Short-term loan"),
+ }],
+ "30": [_("Various transactions"), {
+ "99": _("Cancellation or correction"),
+ "89": _("Undefined transaction"),
+ "87": _("Reimbursement of costs"),
+ "83": _("Value (date) correction"),
+ "55": _("Interest term investment"),
+ "54": _("Capital and/or interest term investment"),
+ "52": _("Forward sale of foreign exchange"),
+ "50": _("Spot sale of foreign exchange"),
+ "49": _("Cancellation or correction"),
+ "39": _("Undefined transaction"),
+ "37": _("Costs"),
+ "33": _("Value (date) correction"),
+ "05": _("Capital and/or interest term investment"),
+ "03": _("Forward purchase of foreign exchange"),
+ "01": _("Spot purchase of foreign exchange"),
+ }],
+ "35": [_("Closing (periodical settlements for interest, costs,…)"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "50": _("Closing"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs"),
+ "01": _("Closing"),
+ }],
+ "41": [_("International credit transfers - non-SEPA credit transfers"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "66": _("Financial centralisation (credit)"),
+ "64": _("Transfer to your account"),
+ "50": _("Transfer"),
+ "49": _("Cancellation or correction"),
+ "38": _("Costs relating to incoming foreign and non-SEPA transfers"),
+ "37": _("Costs relating to outgoing foreign transfers and non-SEPA transfers"),
+ "17": _("Financial centralisation (debit)"),
+ "13": _("Transfer from your account"),
+ "07": _("Collective transfers"),
+ "05": _("Collective payments of wages"),
+ "03": _("Standing order"),
+ "01": _("Transfer"),
+ }],
+ "43": [_("Foreign cheques"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "70": _("Purchase of traveller’s cheque"),
+ "62": _("Reversal of cheques"),
+ "58": _("Remittance of foreign cheque credit after collection"),
+ "52": _("Remittance of foreign cheque credit under usual reserve"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs relating to payment of foreign cheques"),
+ "15": _("Purchase of an international bank cheque"),
+ "07": _("Unpaid foreign cheque"),
+ "01": _("Payment of a foreign cheque"),
+ }],
+ "47": [_("Foreign commercial paper"), {
+ "99": _("Cancellation or correction"),
+ "87": _("Reimbursement of costs"),
+ "64": _("Warrant"),
+ "62": _("Remittance of documents abroad - credit after collection"),
+ "60": _("Remittance of documents abroad - credit under usual reserve"),
+ "58": _("Idem without guarantee"),
+ "56": _("Remittance of guaranteed foreign supplier's bill"),
+ "54": _("Discount abroad"),
+ "52": _("Remittance of foreign bill credit under usual reserve"),
+ "50": _("Remittance of foreign bill credit after collection"),
+ "49": _("Cancellation or correction"),
+ "37": _("Costs relating to the payment of a foreign bill"),
+ "14": _("Warrant fallen due"),
+ "13": _("Discount foreign supplier's bills"),
+ "11": _("Payment documents abroad"),
+ "07": _("Unpaid foreign bill"),
+ "06": _("Extension"),
+ "05": _("Bill claimed back"),
+ "01": _("Payment of foreign bill"),
+ }],
+ "49": [_("Foreign counter transactions"), {"03": _("ATM withdrawal")}],
+ "80": [_("Separately charged costs and provisions"), {
+ "01": _("Guarantee card charges"),
+ "02": _("Costs relating to electronic output"),
+ "03": _("Payment card charges"),
+ "04": _("Costs for holding a documentary cash credit"),
+ "05": _("Card charges"),
+ "06": _("Damage relating to bills and cheques"),
+ "07": _("Insurance costs"),
+ "08": _("Registering compensation for savings accounts"),
+ "09": _("Postage"),
+ "10": _("Purchase of Smartcard"),
+ "11": _("Costs for the safe custody of correspondence"),
+ "12": _("Costs for opening a bank guarantee"),
+ "13": _("Renting of safes"),
+ "14": _("Handling costs instalment credit"),
+ "15": _("Night safe"),
+ "16": _("Bank confirmation to revisor or accountant"),
+ "17": _("Charge for safe custody"),
+ "18": _("Trade information"),
+ "19": _("Special charge for safe custody"),
+ "20": _("Drawing up a certificate"),
+ "21": _("Pay-packet charges"),
+ "22": _("Management/custody"),
+ "23": _("Research costs"),
+ "24": _("Participation in and management of interest refund system"),
+ "25": _("Renting of direct debit box"),
+ "26": _("Travel insurance premium"),
+ "27": _("Subscription fee"),
+ "29": _("Information charges"),
+ "31": _("Writ service fee"),
+ "33": _("Miscellaneous fees and commissions"),
+ "35": _("Costs"),
+ "37": _("Access right to database"),
+ "39": _("Surety fee"),
+ "41": _("Research costs"),
+ "43": _("Printing of forms"),
+ "45": _("Documentary credit charges"),
+ "47": _("Charging fees for transactions"),
+ "49": _("Cancellation or correction"),
+ "99": _("Cancellation or correction"),
+ }],
+}
+
+transaction_categories = {
+ "000": _("Net amount"),
+ "001": _("Interest received"),
+ "002": _("Interest paid"),
+ "003": _("Credit commission"),
+ "004": _("Postage"),
+ "005": _("Renting of letterbox"),
+ "006": _("Various fees/commissions"),
+ "007": _("Access right to database"),
+ "008": _("Information charges"),
+ "009": _("Travelling expenses"),
+ "010": _("Writ service fee"),
+ "011": _("VAT"),
+ "012": _("Exchange commission"),
+ "013": _("Payment commission"),
+ "014": _("Collection commission"),
+ "015": _("Correspondent charges"),
+ "016": _("BLIW/IBLC dues"),
+ "017": _("Research costs"),
+ "018": _("Tental guarantee charges"),
+ "019": _("Tax on physical delivery"),
+ "020": _("Costs of physical delivery"),
+ "021": _("Costs for drawing up a bank cheque"),
+ "022": _("Priority costs"),
+ "023": _("Exercising fee"),
+ "024": _("Growth premium"),
+ "025": _("Individual entry for exchange charges"),
+ "026": _("Handling commission"),
+ "027": _("Charges for unpaid bills"),
+ "028": _("Fidelity premium"),
+ "029": _("Protest charges"),
+ "030": _("Account insurance"),
+ "031": _("Charges foreign cheque"),
+ "032": _("Drawing up a circular cheque"),
+ "033": _("Charges for a foreign bill"),
+ "034": _("Reinvestment fee"),
+ "035": _("Charges foreign documentary bill"),
+ "036": _("Costs relating to a refused cheque"),
+ "037": _("Commission for handling charges"),
+ "039": _("Telecommunications"),
+ "041": _("Credit card costs"),
+ "042": _("Payment card costs"),
+ "043": _("Insurance costs"),
+ "045": _("Handling costs"),
+ "047": _("Charges extension bill"),
+ "049": _("Fiscal stamps/stamp duty"),
+ "050": _("Capital term investment"),
+ "051": _("Withholding tax"),
+ "052": _("Residence state tax"),
+ "053": _("Printing of forms"),
+ "055": _("Repayment loan or credit capital"),
+ "057": _("Interest subsidy"),
+ "058": _("Capital premium"),
+ "059": _("Default interest"),
+ "061": _("Charging fees for transactions"),
+ "063": _("Rounding differences"),
+ "065": _("Interest payment advice"),
+ "066": _("Fixed loan advance - reimbursement"),
+ "067": _("Fixed loan advance - extension"),
+ "068": _("Countervalue of an entry"),
+ "069": _("Forward arbitrage contracts : sum to be supplied by customer"),
+ "070": _("Forward arbitrage contracts : sum to be supplied by bank"),
+ "071": _("Fixed loan advance - availability"),
+ "072": _("Countervalue of commission to third party"),
+ "073": _("Costs of ATM abroad"),
+ "074": _("Mailing costs"),
+ "100": _("Gross amount"),
+ "200": _("Overall documentary credit charges"),
+ "201": _("Advice notice commission"),
+ "202": _("Advising commission | Additional advising commission"),
+ "203": _("Confirmation fee | Additional confirmation fee | Commitment fee | Flat fee | Confirmation reservation commission | Additional reservation commission"),
+ "204": _("Amendment fee"),
+ "205": _("Documentary payment commission | Document commission | Drawdown fee | Negotiation fee"),
+ "206": _("Surety fee/payment under reserve"),
+ "207": _("Non-conformity fee"),
+ "208": _("Commitment fee deferred payment"),
+ "209": _("Transfer commission"),
+ "210": _("Commitment fee"),
+ "211": _("Credit arrangement fee | Additional credit arrangement fee"),
+ "212": _("Warehousing fee"),
+ "213": _("Financing fee"),
+ "214": _("Issue commission (delivery order)"),
+ "400": _("Acceptance fee"),
+ "401": _("Visa charges"),
+ "402": _("Certification costs"),
+ "403": _("Minimum discount rate"),
+ "404": _("Discount commission"),
+ "405": _("Bill guarantee commission"),
+ "406": _("Collection charges"),
+ "407": _("Costs Article 45"),
+ "408": _("Cover commission"),
+ "409": _("Safe deposit charges"),
+ "410": _("Reclamation charges"),
+ "411": _("Fixed collection charge"),
+ "412": _("Advice of expiry charges"),
+ "413": _("Acceptance charges"),
+ "414": _("Regularisation charges"),
+ "415": _("Surety fee"),
+ "416": _("Charges for the deposit of security"),
+ "418": _("Endorsement commission"),
+ "419": _("Bank service fee"),
+ "420": _("Retention charges"),
+ "425": _("Foreign broker's commission"),
+ "426": _("Belgian broker's commission"),
+ "427": _("Belgian Stock Exchange tax"),
+ "428": _("Interest accrued"),
+ "429": _("Foreign Stock Exchange tax"),
+ "430": _("Recovery of foreign tax"),
+ "431": _("Delivery of a copy"),
+}
-def str2date(date_str):
- try:
- return time.strftime('%Y-%m-%d', time.strptime(date_str, '%d%m%y'))
- except:
- return False
+def rmspaces(s):
+ return " ".join(s.split())
-def str2time(time_str):
- return time_str[:2] + ':' + time_str[2:]
-
-def str2float(str):
- try:
- return float(str)
- except:
- return 0.0
-
-
-def list2float(lst):
- try:
- return str2float((lambda s: s[:-3] + '.' + s[-3:])(lst))
- except:
- return 0.0
-
-
-def number2float(s, d):
- try:
- return float(s[:len(s) - d] + '.' + s[len(s) - d:])
- except:
- return False
-
-
-def _get_acc_numbers(acc_number):
- #TODO this method is needed because the iban and bank account fields have been merged together. But sometimes we
- # need to retrieve the normal bank account from the IBAN. This should be globalized and defined as a method on the
- # bank account class. Each country part of the IBAN area should define its own code to do so.
- acc_number = acc_number.replace(' ', '')
- if acc_number.lower().startswith('be'):
- return [acc_number[4:], acc_number]
- return [acc_number]
-
-from base_iban.base_iban import _ref_iban, _format_iban
-
-
-def calc_iban_checksum(country, bban):
- bban = bban.replace(' ', '').upper() + country.upper() + '00'
- base = ''
- for c in bban:
- if c.isdigit():
- base += c
- else:
- base += str(ord(c) - ord('A') + 10)
- kk = 98 - int(base) % 97
- return str(kk).rjust(2, '0')
-
-
-def check_bban(country, bban):
- if country == 'BE':
- try:
- int(bban)
- except:
- return False
- if len(bban) != 12:
- return False
- return True
-
-
-def check_iban(iban):
- """
- Check the IBAN number (logic partially based upon base_iban module, cf. is_iban_valid method)
- """
- iban = _format_iban(iban).lower()
- if iban[:2] not in _ref_iban:
- return False
- if len(iban) != len(_format_iban(_ref_iban[iban[:2]])):
- return False
- #the four first digits have to be shifted to the end
- iban = iban[4:] + iban[:4]
- #letters have to be transformed into numbers (a = 10, b = 11, ...)
- iban2 = ""
- for char in iban:
- if char.isalpha():
- iban2 += str(ord(char) - 87)
- else:
- iban2 += char
- #iban is correct if modulo 97 == 1
- return int(iban2) % 97 == 1
-
-
-def get_bank(self, cr, uid, bic, iban):
-
- country_obj = self.pool.get('res.country')
- bank_obj = self.pool.get('res.bank')
-
- bank_id = False
- bank_name = False
- feedback = False
- bank_country = iban[:2]
- try:
- bank_country_id = country_obj.search(cr, uid, [('code', '=', bank_country)])[0]
- except:
- feedback = _("\n Bank lookup failed due to missing Country definition for Country Code '%s' !") \
- % (bank_country)
- else:
- if iban[:2] == 'BE' and 'code' in bank_obj.fields_get_keys(cr, uid):
- # To DO : extend for other countries
- bank_code = iban[4:7]
- if bic:
- bank_ids = bank_obj.search(cr, uid, [('bic', '=', bic), ('code', '=', bank_code), ('country', '=', bank_country_id)])
- if bank_ids:
- bank_id = bank_ids[0]
- else:
- bank_id = bank_obj.create(cr, uid, {
- 'name': bic,
- 'code': bank_code,
- 'bic': bic,
- 'country': bank_country_id,
- })
- else:
- bank_ids = bank_obj.search(cr, uid, [('code', '=', bank_code), ('country', '=', bank_country_id)])
- if bank_ids:
- bank_id = bank_ids[0]
- bank_data = bank_obj.read(cr, uid, bank_id, fields=['bic', 'name'])
- bic = bank_data['bic']
- bank_name = bank_data['name']
- else:
- country = country_obj.browse(cr, uid, bank_country_id)
- feedback = _("\n Bank lookup failed. Please define a Bank with Code '%s' and Country '%s' !") \
- % (bank_code, country.name)
- else:
- if not bic:
- feedback = _("\n Bank lookup failed due to missing BIC in Bank Statement for IBAN '%s' !") \
- % (iban)
- else:
- bank_ids = bank_obj.search(cr, uid, [('bic', '=', bic), ('country', '=', bank_country_id)])
- if not bank_ids:
- bank_name = bic
- bank_id = bank_obj.create(cr, uid, {
- 'name': bank_name,
- 'bic': bic,
- 'country': bank_country_id,
- })
- else:
- bank_id = bank_ids[0]
-
- return bank_id, bic, bank_name, feedback
-
-
-def update_partner_bank(self, cr, uid, bic, iban, partner_id, counterparty_name):
- partner_bank_obj = self.pool.get('res.partner.bank')
- bank_id = False
- feedback = False
- if check_iban(iban):
- bank_id, bic, bank_name, feedback = get_bank(self, cr, uid, bic, iban)
- if not bank_id:
- return feedback
- else:
- #convert belgian BBAN numbers to IBAN
- if check_bban('BE', iban):
- kk = calc_iban_checksum('BE', iban)
- iban = 'BE' + kk + iban
- bank_id, bic, bank_name, feedback = get_bank(self, cr, uid, bic, iban)
- if not bank_id:
- return feedback
-
- if bank_id:
- partner_bank_obj.create(cr, uid, {
- 'partner_id': partner_id,
- 'name': counterparty_name,
- 'bank': bank_id,
- 'state': 'iban',
- 'bank_bic': bic,
- 'bank_name': bank_name,
- 'acc_number': iban,
- })
- return feedback
-
-indent = '\n' + 8 * ' '
-st_line_name_families = ['13', '35', '41', '80']
-parse_comms_move = ['100', '101', '102', '103', '105', '106', '107', '108', '111', '113', '114', '115', '121', '122', '123', '124', '125', '126', '127']
-parse_comms_info = ['001', '002', '004', '005', '006', '007', '107', '008', '009', '010', '011']
-
-
-def get_st_line_name(line, context):
- #_logger.warn('get_st_line_name - entry').warn('ref = %s, family = %s, code = %s, categ = %s', line['ref'], line['trans_family'], line['trans_code'], line['trans_category'])
- st_line_name = line['name']
-
- if line['trans_family'] == '35' and line['trans_code'] in ['01', '37']:
- st_line_name = ', '.join([_('Closing'), line['trans_code_desc'], line['trans_category_desc']])
-
- if line['trans_family'] in ['13', '41']:
- st_line_name = ', '.join([line['trans_family_desc'], line['trans_code_desc'], line['trans_category_desc']])
-
- if line['trans_family'] in ['80']:
- st_line_name = ', '.join([line['trans_code_desc'], line['trans_category_desc']])
-
- return st_line_name
-
-
-def parse_comm_move(self, cr, uid, line, comm_type_table, context):
- #_logger.warn('parse_comm_move - entry, ref = %s, family = %s, code = %s, categ = %s, comm_type = %s, name = %s', line['ref'], line['trans_family'], line['trans_code'], line['trans_category'], line['struct_comm_type'], line['name'])
- comm_type = line['struct_comm_type']
- comm = st_line_comm = line['communication']
- st_line_name = line['name']
-
- if comm_type in ['115', '121', '122', '126']:
- _logger.warn('The parsing of Structured Commmunication Type %s has not yet been implemented. ' \
- 'Please contact Noviat (info@noviat.be) for more information about the development roadmap', comm_type)
-
- if comm_type == '100':
- st_line_name = _('Payment with ISO 11649 structured format communication')
- st_line_comm = '\n' + indent + _('Payment with a structured format communication applying the ISO standard 11649') + ':'
- st_line_comm += indent + _('Structured creditor reference to remittance information')
- st_line_comm += indent + comm
-
- if comm_type in ['101', '102']:
- st_line_name = st_line_comm = '+++' + comm[0:3] + '/' + comm[3:7] + '/' + comm[7:12] + '+++'
-
- if comm_type == '103':
- st_line_name = ', '.join([line['trans_family_desc'], _('Number')])
- st_line_comm = comm
-
- if comm_type == '105':
- st_line_name = filter(lambda x: comm_type == x['code'], comm_type_table)[0]['description']
- amount_1 = list2float(comm[0:15])
- amount_2 = list2float(comm[15:30])
- rate = number2float(comm[30:42], 8)
- currency = comm[42:45]
- struct_format_comm = comm[45:57].strip()
- country_code = comm[57:59]
- amount_3 = list2float(comm[59:74])
- st_line_comm = '\n' + indent + st_line_name + indent + _('Gross amount in the currency of the account') + ': %.2f' % amount_1
- st_line_comm += indent + _('Gross amount in the original currency') + ': %.2f' % amount_2
- st_line_comm += indent + _('Rate') + ': %.4f' % rate
- st_line_comm += indent + _('Currency') + ': %s' % currency
- st_line_comm += indent + _('Structured format communication') + ': %s' % struct_format_comm
- st_line_comm += indent + _('Country code of the principal') + ': %s' % country_code
- st_line_comm += indent + _('Equivalent in EUR') + ': %.2f' % amount_3
-
- if comm_type == '106':
- if not st_line_name and line['trans_family'] not in st_line_name_families:
- st_line_name = _('VAT, withholding tax on income, commission, etc.')
- interest = comm[30:42].strip('0')
- st_line_comm = '\n' + indent + st_line_name + indent + _('Equivalent in the currency of the account') + ': %.2f' % list2float(comm[0:15])
- st_line_comm += indent + _('Amount on which % is calculated') + ': %.2f' % list2float(comm[15:30])
- st_line_comm += indent + _('Percent') + ': %.4f' % number2float(comm[30:42], 8)
- st_line_comm += indent + (comm[42] == 1 and _('Minimum applicable') or _('Minimum not applicable'))
- st_line_comm += indent + _('Equivalent in EUR') + ': %.2f' % list2float(comm[43:58])
-
- if comm_type == '107':
- paid_refusals = {
- '0': _('paid'),
- '1': _('direct debit cancelled or nonexistent'),
- '2': _('refusal - other reason'),
- 'D': _('payer disagrees'),
- 'E': _('direct debit number linked to another identification number of the creditor')}
- st_line_name = _('Direct debit - DOM\'80')
- direct_debit_number = comm[0:12].strip()
- pivot_date = str2date(comm[12:18])
- comm_zone = comm[18:48]
- paid_refusal = paid_refusals.get(comm[48], '')
- creditor_number = comm[49:60].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Direct Debit Number') + ': %s' % direct_debit_number
- st_line_comm += indent + _('Central (Pivot) Date') + ': %s' % pivot_date
- st_line_comm += indent + _('Communication Zone') + ': %s' % comm_zone
- st_line_comm += indent + _('Paid or reason for refusal') + ': %s' % paid_refusal
- st_line_comm += indent + _("Creditor's Number") + ': %s' % creditor_number
-
- if comm_type == '108':
- st_line_name = _('Closing, period from %s to %s') % (str2date(comm[42:48]), str2date(comm[48:54]))
- interest = comm[30:42].strip('0')
- st_line_comm = '\n' + indent + st_line_name + indent + _('Equivalent in the currency of the account') + ': %.2f' % list2float(comm[0:15])
- if interest:
- st_line_comm += indent + _('Interest rates, calculation basis') + ': %.2f' % list2float(comm[15:30]) + \
- indent + _('Interest') + ': %.2f' % list2float(comm[30:42])
-
- if comm_type == '111':
- card_schemes = {
- '1': 'Bancontact/Mister Cash',
- '2': _('Private'),
- '3': 'Maestro',
- '5': 'TINA',
- '9': _('Other')}
- trans_types = {
- '1': _('Withdrawal'),
- '2': _('Cumulative on network'),
- '7': _('Distribution sector'),
- '8': _('Teledata'),
- '9': _('Fuel')}
- st_line_name = _('POS credit - globalisation')
- card_scheme = card_schemes.get(comm[0], '')
- pos_number = comm[1:7].strip()
- period_number = comm[7:10].strip()
- first_sequence_number = comm[10:16].strip()
- trans_first_date = str2date(comm[16:22])
- last_sequence_number = comm[22:28].strip()
- trans_last_date = str2date(comm[28:34])
- trans_type = trans_types.get(comm[34], '')
- terminal_name = comm[35:50].strip()
- terminal_city = comm[51:60].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Card Scheme') + ': %s' % card_scheme
- st_line_comm += indent + _('POS Number') + ': %s' % pos_number
- st_line_comm += indent + _('Period Number') + ': %s' % period_number
- st_line_comm += indent + _('First Transaction Sequence Number') + ': %s' % first_sequence_number
- st_line_comm += indent + _('Date of first transaction') + ': %s' % trans_first_date
- st_line_comm += indent + _('Last Transaction Sequence Number') + ': %s' % last_sequence_number
- st_line_comm += indent + _('Date of last transaction') + ': %s' % trans_last_date
- st_line_comm += indent + _('Transaction Type') + ': %s' % trans_type
- st_line_comm += indent + _('Terminal Identification') + ': %s' % terminal_name + ', ' + terminal_city
-
- if comm_type == '113':
- card_schemes = {
- '1': 'Bancontact/Mister Cash',
- '2': 'Maestro',
- '3': _('Private'),
- '9': _('Other')}
- trans_types = {
- '1': _('Withdrawal'),
- '2': _('Proton loading'),
- '3': _('Reimbursement Proton balance'),
- '4': _('Reversal of purchases'),
- '7': _('Distribution sector'),
- '8': _('Teledata'),
- '9': _('Fuel')}
- product_codes = {
- '01': _('premium with lead substitute'),
- '02': _('europremium'),
- '03': _('diesel'),
- '04': _('LPG'),
- '06': _('premium plus 98 oct'),
- '07': _('regular unleaded'),
- '08': _('domestic fuel oil'),
- '09': _('lubricants'),
- '10': _('petrol'),
- '11': _('premium 99+'),
- '12': _('Avgas'),
- '16': _('other types'),
- }
- st_line_name = _('ATM/POS debit')
- card_number = comm[0:16].strip()
- card_scheme = card_schemes.get(comm[16], '')
- terminal_number = comm[17:23].strip()
- sequence_number = comm[23:29].strip()
- trans_date = comm[29:35].strip() and str2date(comm[29:35]) or ''
- trans_hour = comm[35:39].strip() and str2time(comm[35:39]) or ''
- trans_type = trans_types.get(comm[39], '')
- terminal_name = comm[40:56].strip()
- terminal_city = comm[56:66].strip()
- orig_amount = comm[66:81].strip() and list2float(comm[66:81])
- rate = number2float(comm[81:93], 8)
- currency = comm[93:96]
- volume = number2float(comm[96:101], 2)
- product_code = product_codes.get(comm[101:103], '')
- unit_price = number2float(comm[103:108], 2)
- st_line_comm = '\n' + indent + st_line_name + indent + _('Card Number') + ': %s' % card_number
- st_line_comm += indent + _('Card Scheme') + ': %s' % card_scheme
- if terminal_number:
- st_line_comm += indent + _('Terminal Number') + ': %s' % terminal_number
- st_line_comm += indent + _('Transaction Sequence Number') + ': %s' % sequence_number
- st_line_comm += indent + _('Time') + ': %s' % trans_date + ' ' + trans_hour
- st_line_comm += indent + _('Transaction Type') + ': %s' % trans_type
- st_line_comm += indent + _('Terminal Identification') + ': %s' % terminal_name + ', ' + terminal_city
- if orig_amount:
- st_line_comm += indent + _('Original Amount') + ': %.2f' % orig_amount
- st_line_comm += indent + _('Rate') + ': %.4f' % rate
- st_line_comm += indent + _('Currency') + ': %s' % currency
- if volume:
- st_line_comm += indent + _('Volume') + ': %.2f' % volume
- if product_code:
- st_line_comm += indent + _('Product Code') + ': %s' % product_code
- if unit_price:
- st_line_comm += indent + _('Unit Price') + ': %.2f' % unit_price
-
- if comm_type == '114':
- card_schemes = {
- '1': 'Bancontact/Mister Cash',
- '2': 'Maestro',
- '3': _('Private'),
- '5': 'TINA',
- '9': _('Other')}
- trans_types = {
- '1': _('Withdrawal'),
- '7': _('Distribution sector'),
- '8': _('Teledata'),
- '9': _('Fuel')}
- st_line_name = _('POS credit - individual transaction')
- card_scheme = card_schemes.get(comm[0], '')
- pos_number = comm[1:7].strip()
- period_number = comm[7:10].strip()
- sequence_number = comm[10:16].strip()
- trans_date = str2date(comm[16:22])
- trans_hour = str2time(comm[22:26])
- trans_type = trans_types.get(comm[26], '')
- terminal_name = comm[27:43].strip()
- terminal_city = comm[43:53].strip()
- trans_reference = comm[53:69].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Card Scheme') + ': %s' % card_scheme
- st_line_comm += indent + _('POS Number') + ': %s' % pos_number
- st_line_comm += indent + _('Period Number') + ': %s' % period_number
- st_line_comm += indent + _('Transaction Sequence Number') + ': %s' % sequence_number
- st_line_comm += indent + _('Time') + ': %s' % trans_date + ' ' + trans_hour
- st_line_comm += indent + _('Transaction Type') + ': %s' % trans_type
- st_line_comm += indent + _('Terminal Identification') + ': %s' % terminal_name + ', ' + terminal_city
- st_line_comm += indent + _('Transaction Reference') + ': %s' % trans_reference
-
- if comm_type == '123':
- starting_date = str2date(comm[0:6])
- maturity_date = comm[6:12] == '999999' and _('guarantee without fixed term') or str2date(comm[0:6])
- basic_amount = list2float(comm[12:27])
- percent = number2float(comm[27:39], 8)
- term = comm[39:43].lstrip('0')
- minimum = comm[43] == '1' and True or False
- guarantee_number = comm[44:57].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Starting Date') + ': %s' % starting_date
- st_line_comm += indent + _('Maturity Date') + ': %s' % maturity_date
- st_line_comm += indent + _('Basic Amount') + ': %.2f' % basic_amount
- st_line_comm += indent + _('Percentage') + ': %.4f' % percent
- st_line_comm += indent + _('Term in days') + ': %s' % term
- st_line_comm += indent + (minimum and _('Minimum applicable') or _('Minimum not applicable'))
- st_line_comm += indent + _('Guarantee Number') + ': %s' % guarantee_number
-
- if comm_type == '124':
- card_issuers = {
- '1': 'Mastercard',
- '2': 'Visa',
- '3': 'American Express',
- '4': 'Diners Club',
- '9': _('Other')}
- st_line_name = _('Settlement credit cards')
- card_number = comm[0:20].strip()
- card_issuer = card_issuers.get(comm[20], '')
- invoice_number = comm[21:33].strip()
- identification_number = comm[33:48].strip()
- date = comm[48:54].strip() and str2date(comm[48:54]) or ''
- st_line_comm = '\n' + indent + st_line_name + indent + _('Card Number') + ': %s' % card_number
- st_line_comm += indent + _('Issuing Institution') + ': %s' % card_issuer
- st_line_comm += indent + _('Invoice Number') + ': %s' % invoice_number
- st_line_comm += indent + _('Identification Number') + ': %s' % identification_number
- st_line_comm += indent + _('Date') + ': %s' % date
-
- if comm_type == '125':
- if line['trans_family'] not in st_line_name_families:
- st_line_name = _('Credit')
- credit_account = comm[0:27].strip()
- if check_bban('BE', credit_account):
- credit_account = '-'.join([credit_account[:3], credit_account[3:10], credit_account[10:]])
- old_balance = list2float(comm[27:42])
- new_balance = list2float(comm[42:57])
- amount = list2float(comm[57:72])
- currency = comm[72:75]
- start_date = str2date(comm[75:81])
- end_date = str2date(comm[81:87])
- rate = number2float(comm[87:99], 8)
- trans_reference = comm[99:112].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Credit Account Number') + ': %s' % credit_account
- st_line_comm += indent + _('Old Balance') + ': %.2f' % old_balance
- st_line_comm += indent + _('New Balance') + ': %.2f' % new_balance
- st_line_comm += indent + _('Amount') + ': %.2f' % amount
- st_line_comm += indent + _('Currency') + ': %s' % currency
- st_line_comm += indent + _('Starting Date') + ': %s' % start_date
- st_line_comm += indent + _('End Date') + ': %s' % end_date
- st_line_comm += indent + _('Nominal Interest Rate or Rate of Charge') + ': %.4f' % rate
- st_line_comm += indent + _('Transaction Reference') + ': %s' % trans_reference
-
- if comm_type == '127':
- direct_debit_types = {
- '0': _('unspecified'),
- '1': _('recurrent'),
- '2': _('one-off'),
- '3': _('1-st (recurrent)'),
- '4': _('last (recurrent)')}
- direct_debit_schemes = {
- '0': _('unspecified'),
- '1': _('SEPA core'),
- '2': _('SEPA B2B')}
- paid_refusals = {
- '0': _('paid'),
- '1': _('technical problem'),
- '2': _('refusal - reason not specified'),
- '3': _('debtor disagrees'),
- '4': _('debtor\'s account problem')}
- R_types = {
- '0': _('paid'),
- '1': _('reject'),
- '2': _('return'),
- '3': _('refund'),
- '4': _('reversal'),
- '5': _('cancellation')}
- st_line_name = _('European direct debit (SEPA)')
- settlement_date = str2date(comm[0:6])
- direct_debit_type = direct_debit_types.get(comm[6], '')
- direct_debit_scheme = direct_debit_schemes.get(comm[7], '')
- paid_refusal = paid_refusals.get(comm[8], '')
- creditor_id = comm[9:44].strip()
- mandate_ref = comm[44:79].strip()
- comm_zone = comm[79:141]
- R_type = R_types.get(comm[141], '')
- reason = comm[142:146].strip()
- st_line_comm = '\n' + indent + st_line_name + indent + _('Settlement_Date') + ': %s' % settlement_date
- st_line_comm += indent + _('Direct Debit Type') + ': %s' % direct_debit_type
- st_line_comm += indent + _('Direct Debit Scheme') + ': %s' % direct_debit_scheme
- st_line_comm += indent + _('Paid or reason for refusal') + ': %s' % paid_refusal
- st_line_comm += indent + _('Creditor\'s Identification Code') + ': %s' % creditor_id
- st_line_comm += indent + _('Mandate Reference') + ': %s' % mandate_ref
- st_line_comm += indent + _('Communication') + ': %s' % comm_zone
- st_line_comm += indent + _('R transaction Type') + ': %s' % R_type
- st_line_comm += indent + _('Reason') + ': %s' % reason
-
- return st_line_name, st_line_comm
-
-
-def parse_comm_info(self, cr, uid, line, comm_type_table, context):
- comm_type = line['struct_comm_type']
- comm = st_line_comm = line['communication']
- st_line_name = line['name']
-
- if comm_type == '001':
- st_line_name = filter(lambda x: comm_type == x['code'], comm_type_table)[0]['description']
- st_line_comm = '\n' + indent + st_line_name + indent + _('Name') + ': %s' % comm[0:70].strip()
- st_line_comm += indent + _('Street') + ': %s' % comm[70:105].strip()
- st_line_comm += indent + _('Locality') + ': %s' % comm[105:140].strip()
- st_line_comm += indent + _('Identification Code') + ': %s' % comm[140:175].strip()
-
- if comm_type in ['002', '004', '005']:
- st_line_name = filter(lambda x: comm_type == x['code'], comm_type_table)[0]['description']
- st_line_comm = comm.strip()
-
- if comm_type == '006':
- amount = (comm[48] == '1' and '-' or '') + ('%.2f' % list2float(comm[33:48])) + ' ' + comm[30:33]
- st_line_name = filter(lambda x: comm_type == x['code'], comm_type_table)[0]['description']
- st_line_comm = '\n' + indent + st_line_name + indent + _('Description of the detail') + ': %s' % comm[0:30].strip()
- st_line_comm += indent + _('Amount') + ': %s' % amount
- st_line_comm += indent + _('Category') + ': %s' % comm[49:52].strip()
-
- if comm_type not in ['001', '002', '004', '005', '006']:
- _logger.warn('The parsing of Structured Commmunication Type %s has not yet been implemented. ' \
- 'Please contact Noviat (info@noviat.be) for more information about the development roadmap', comm_type)
-
- return st_line_name, st_line_comm
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/wizard/account_coda_import_dle.py b/addons/l10n_be_coda/wizard/account_coda_import_dle.py
deleted file mode 100644
index 432008fa58e..00000000000
--- a/addons/l10n_be_coda/wizard/account_coda_import_dle.py
+++ /dev/null
@@ -1,740 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-#
-# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import base64
-from osv import fields, osv
-from tools.translate import _
-import time
-import tools
-import logging
-_logger = logging.getLogger(__name__)
-
-
-class account_coda_import(osv.osv_memory):
- _name = 'account.coda.import'
- _description = 'Import CODA File'
- _columns = {
- 'coda_data': fields.binary('CODA File', required=True),
- 'coda_fname': fields.char('CODA Filename', size=128, required=True),
- 'note': fields.text('Log'),
- }
- _defaults = {
- 'coda_fname': lambda *a: '',
- }
-
- def coda_parsing(self, cr, uid, ids, context=None, batch=False, codafile=None, codafilename=None):
- if context is None:
- context = {}
- if batch:
- print
- codafile = str(codafile)
- codafilename = codafilename
- else:
- data = self.browse(cr, uid, ids)[0]
- try:
- codafile = data.coda_data
- codafilename = data.coda_fname
- except:
- raise osv.except_osv(_('Error!'), _('Wizard in incorrect state. Please hit the Cancel button!'))
- return {}
- recordlist = unicode(base64.decodestring(codafile), 'windows-1252', 'strict').split('\n')
- statements = []
- for line in recordlist:
- if not line:
- pass
- elif line[0] == '0':
- #Begin of a new Bank statement
- statement = {}
- statements.append(statement)
- 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])
- elif line[0] == '1':
- #Statement details
- if statement['version'] == '1':
- statement['accountNumber'] = rmspaces(line[5:17])
- statement['currency'] = rmspaces(line[18:21])
- elif statement['version'] == '2':
- if line[1] == '0': # Belgian bank account BBAN structure
- statement['accountNumber'] = rmspaces(line[5:17])
- statement['currency'] = rmspaces(line[18:21])
- elif line[1] == '1': # foreign bank account BBAN structure
- raise osv.except_osv(_('Error R1001!'), _('Foreign bank accounts with BBAN structure are not supported !'))
- elif line[1] == '2': # Belgian bank account IBAN structure
- statement['accountNumber'] = rmspaces(line[5:21])
- statement['currency'] = rmspaces(line[39:42])
- elif line[1] == '3': # foreign bank account IBAN structure
- raise osv.except_osv(_('Error R1002!'), _('Foreign bank accounts with IBAN structure are not supported !'))
- else: # Something else, not supported
- raise osv.except_osv(_('Error R1003!'), _('\nUnsupported bank account structure !'))
- statement['description'] = rmspaces(line[90:125])
- statement['balance_start'] = float(rmspaces(line[43:58])) / 1000
- statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y'))
- statement['accountHolder'] = rmspaces(line[64:90])
- statement['paperSeqNumber'] = rmspaces(line[2:5])
- statement['codaSeqNumber'] = rmspaces(line[125:128])
- elif line[0] == '2':
- if line[1] == '1':
- #New statement line
- statementLine = {}
- statementLine['type'] = 'general'
- statementLine['ref'] = rmspaces(line[2:10])
- statementLine['ref_move'] = rmspaces(line[2:6])
- statementLine['ref_move_detail'] = rmspaces(line[6:10])
- statementLine['sequence'] = len(statement['lines']) + 1
- statementLine['transactionRef'] = rmspaces(line[10:31])
- statementLine['debit'] = line[31] # 0 = Credit, 1 = Debit
- statementLine['amount'] = float(rmspaces(line[32:47])) / 1000
- if statementLine['debit'] == '1':
- statementLine['amount'] = - statementLine['amount']
- statementLine['transaction_type'] = line[53]
- if statementLine['transaction_type'] not in transaction_types:
- raise osv.except_osv(_('Error R2001!'), _('The File contains an invalid CODA Transaction Type : %s!') % statementLine['transaction_type'])
- statementLine['transactionDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[47:53]), '%d%m%y'))
- statementLine['transaction_family'] = rmspaces(line[54:56])
- #TODO Handling severals transactions Family
- statementLine['transaction_code'] = rmspaces(line[56:58])
- #TODO Handling severals transactions code
- statementLine['transaction_category'] = rmspaces(line[58:61])
- #TODO Handling severals transactions category
- statementLine['communication'] = rmspaces(line[62:115])
- #TODO Handling structured communication
- statementLine['entryDate'] = rmspaces(line[115:121])
- statementLine['type'] = 'normal'
- statementLine['globalisation'] = int(line[124])
- if len(statement['globalisation_stack']) > 0:
- statementLine['communication'] = "\n".join([statement['globalisation_stack'][-1]['communication'], statementLine['communication']])
- if statementLine['globalisation'] > 0:
- if len(statement['globalisation_stack']) > 0 and statement['globalisation_stack'][-1]['globalisation'] == statementLine['globalisation']:
- # Destack
- statement['globalisation_stack'].pop()
- else:
- #Stack
- statementLine['type'] = 'globalisation'
- statement['globalisation_stack'].append(statementLine)
- statement['lines'].append(statementLine)
- elif line[1] == '2':
- if statement['lines'][-1]['ref'][0:4] != line[2:6]:
- raise osv.except_osv(_('Error R2004!'), _('CODA parsing error on movement data record 2.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
- statement['lines'][-1]['communication'] += rmspaces(line[10:63])
- statement['lines'][-1]['payment_reference'] = rmspaces(line[63:98])
- statement['lines'][-1]['counterparty_bic'] = rmspaces(line[98:109])
- elif line[1] == '3':
- if statement['lines'][-1]['ref'][0:4] != line[2:6]:
- raise osv.except_osv(_('Error R2005!'), _('CODA parsing error on movement data record 2.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
- if statement['version'] == '1':
- statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
- statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:125])
- statement['lines'][-1]['counterpartyCurrency'] = ''
- else:
- if line[22] == ' ':
- statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
- statement['lines'][-1]['counterpartyCurrency'] = rmspaces(line[23:26])
- else:
- statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:44])
- statement['lines'][-1]['counterpartyCurrency'] = rmspaces(line[44:47])
- statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:82])
- statement['lines'][-1]['communication'] += rmspaces(line[82:125])
- else:
- # movement data record 2.x (x != 1,2,3)
- raise osv.except_osv(_('Error R2009!'), _('\nMovement data records of type 2.%s are not supported !') % line[1])
- elif line[0] == '3':
- if line[1] == '1':
- infoLine = {}
- infoLine['entryDate'] = statement['lines'][-1]['entryDate']
- infoLine['type'] = 'information'
- infoLine['sequence'] = len(statement['lines']) + 1
- infoLine['ref'] = rmspaces(line[2:10])
- infoLine['transactionRef'] = rmspaces(line[10:31])
- infoLine['transaction_type'] = line[31]
- infoLine['transaction_family'] = rmspaces(line[32:34])
- infoLine['transaction_code'] = rmspaces(line[34:36])
- infoLine['transaction_category'] = rmspaces(line[36:39])
- infoLine['communication'] = rmspaces(line[40:113])
- infoLine['amount'] = 0.0
- infoLine['type'] = 'information'
- statement['lines'].append(infoLine)
- elif line[1] == '2':
- if infoLine['ref'] != rmspaces(line[2:10]):
- raise osv.except_osv(_('Error R3004!'), _('CODA parsing error on information data record 3.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
- statement['lines'][-1]['communication'] += rmspaces(line[10:100])
- elif line[1] == '3':
- if infoLine['ref'] != rmspaces(line[2:10]):
- raise osv.except_osv(_('Error R3005!'), _('CODA parsing error on information data record 3.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
- statement['lines'][-1]['communication'] += rmspaces(line[10:100])
- elif line[0] == '4':
- comm_line = {}
- comm_line['type'] = 'communication'
- comm_line['sequence'] = len(statement['lines']) + 1
- comm_line['ref'] = rmspaces(line[2:10])
- comm_line['communication'] = rmspaces(line[32:112])
- comm_line['amount'] = 0.0
- comm_line['type'] = 'communication'
- statement['lines'].append(comm_line)
- elif line[0] == '8':
- # new balance record
- statement['debit'] = line[41]
- statement['paperSeqNumber'] = rmspaces(line[1:4])
- statement['balance_end_real'] = float(rmspaces(line[42:57])) / 1000
- statement['balance_end_realDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[57:63]), '%d%m%y'))
- if statement['debit'] == '1': # 1=Debit
- statement['balance_end_real'] = - statement['balance_end_real']
- if statement['balance_end_realDate']:
- period_id = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', statement['balance_end_realDate']), ('date_stop', '>=', statement['balance_end_realDate'])])
- else:
- period_id = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', statement['date']), ('date_stop', '>=', statement['date'])])
- if not period_id and len(period_id) == 0:
- raise osv.except_osv(_('Error R0002!'), _("The CODA Statement New Balance date doesn't fall within a defined Accounting Period! Please create the Accounting Period for date %s.") % statement['balance_end_realDate'])
- statement['period_id'] = period_id[0]
- elif line[0] == '9':
- statement['balanceMin'] = float(rmspaces(line[22:37])) / 1000
- statement['balancePlus'] = float(rmspaces(line[37:52])) / 1000
- if not statement['balance_end_real']:
- statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
- for i, statement in enumerate(statements):
- # print '---STATEMENT #' + str(i) + '---'
- print statement
- data = {
- 'name': '[' + statement['date'] + ']' + statement['description'],
- 'date': statement['date'],
- 'journal_id': 18,
- 'period_id': statement['period_id'],
- 'balance_start': statement['balance_start'],
- 'balance_end_real': statement['balance_end_real'],
- 'account_id': 1
- }
- statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
- for line in statement['lines']:
- if line['type'] == 'normal':
- counterparty = []
- if 'counterpartyName' in line:
- counterparty.append(line['counterpartyName'])
- if 'counterpartyNumber' in line:
- counterparty.append(line['counterpartyNumber'])
- if len(counterparty) > 0:
- counterparty = '[' + ' / '.join(counterparty) + ']'
- else:
- counterparty = '/'
- if line['transaction_type'] in transaction_types:
- line['transaction_type'] = transaction_types[line['transaction_type']][1]
- if line['transaction_category'] in transaction_categories:
- line['transaction_category'] = transaction_categories[line['transaction_category']]
- if line['transaction_family'] in transaction_codes:
- transaction_family = transaction_codes[line['transaction_family']]
- line['transaction_family'] = transaction_family[0]
- if line['transaction_code'] in transaction_family[1]:
- line['transaction_code'] = transaction_family[1][line['transaction_code']]
- note = []
- note.append(_('Counter Party') + ': ' + counterparty)
- note.append(_('Communication') + ': ' + line['communication'])
- note.append(_('Transaction type') + ': ' + line['transaction_type'])
- note.append(_('Transaction family') + ': ' + line['transaction_family'])
- note.append(_('Transaction code') + ': ' + line['transaction_code'])
- note.append(_('Transaction category') + ': ' + line['transaction_category'])
-
- try:
- if 'counterpartyNumber' in line and int(line['counterpartyNumber']) == 0:
- line['counterpartyNumber'] = False
- except:
- pass
- if 'counterpartyNumber' in line and line['counterpartyNumber']:
- ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
- if ids and len(ids) > 0:
- partner_id = self.pool.get('res.partner.bank').browse(cr, uid, ids[0],context=context).partner_id.id
- else:
- partner_id = None
-
- data = {
- 'name': line['communication'],
- 'note': "\n".join(note),
- 'date': line['entryDate'],
- 'amount': line['amount'],
- # 'type': '',
- 'partner_id': partner_id,
- 'account_id': 1,
- 'statement_id': statement['id'],
- # 'analytic_account_id': '',
- # 'move_ids': '',
- 'ref': line['ref'],
- 'sequence': line['sequence'],
- }
- self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
-
-account_coda_import()
-
-transaction_types = {
- "0": ["", _("Simple amount without detailed data; e.g. : an individual credit transfer [free of charges].")],
- "1": ["", _("Amount as totalised by the customer; e.g. a file regrouping payments of wages or payments made to suppliers or a file regrouping collections for which the customer is ]debited or credited with one single amount. As a matter of principle, this type is also used when no detailed data is following [type 5].")],
- "5": ["1", _("Detail of 1. Standard procedure is no detailing. However, the customer may ask for detailed data to be included into his file after the overall record [type 1].")],
- "2": ["", _("Amount as totalised by the bank; e.g. : the total amount of a series of credit transfers with a structured communication As a matter of principle, this type will also be used when no detailed data [type 6 or 7] is following.")],
- "6": ["2", _("Detail of 2. Simple amount without detailed data. Normally, data of this kind comes after type 2. The customer may ask for a separate file containing the detailed data. In that case, one will speak of a ‘separate application’. The records in a separate application keep type 6.")],
- "7": ["2", _("Detail of 2. Simple account with detailed data The records in a separate application keep type 7.")],
- "9": ["7", _("Detail of 7. The records in a separate application keep type 9.")],
- "3": ["", _("Simple amount with detailed data; e.g. in case of charges for cross-border credit transfers.")],
- "8": ["3", _("Detail of 3.")],
-}
-
-transaction_codes = {
- "00": [_("Undefined transactions"), {
- "89": _("Cancellation of a transaction"),
- "87": _("Costs refunded"),
- "85": _("Correction"),
- "83": _("Value correction"),
- "39": _("Cancellation of a transaction"),
- "37": _("Costs"),
- "35": _("Correction"),
- "33": _("Value correction"),
- "00": _("Undefined transaction")
- }],
- "01": [_("Domestic or local SEPA credit transfers"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "66": _("Financial centralization"),
- "64": _("Transfer to your account"),
- "62": _("Unpaid postal order"),
- "60": _("Non-presented circular cheque"),
- "54": _("Unexecutable transfer order"),
- "52": _("Payment in your favour"),
- "51": _("Transfer in your favour – initiated by the bank"),
- "50": _("Transfer in your favour"),
- "49": _("Cancellation or correction"),
- "39": _("Your issue circular cheque"),
- "37": _("Costs"),
- "17": _("Financial centralisation"),
- "15": _("Balance due insurance premium"),
- "13": _("Transfer from your account"),
- "11": _("Your semi-standing order – payment to employees"),
- "09": _("Your semi-standing order"),
- "07": _("Collective transfer"),
- "05": _("Payment of wages etc."),
- "03": _("Standing order"),
- "02": _("Individual transfer order initiated by the bank"),
- "01": _("Individual transfer order]"),
- }],
- "03": [_("Cheques"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of cheque-related costs"),
- "68": _("Credit of a payment via electronic purse"),
- "66": _("Remittance of cheque by your branch - credit under usual reserve"),
- "64": _("Reversal of settlement of credit card"),
- "63": _("Second credit of unpaid cheque"),
- "62": _("Reversal of cheque"),
- "60": _("Reversal of voucher"),
- "58": _("Remittance of cheques, vouchers, etc. credit after collection"),
- "56": _("Non-presented certified cheques"),
- "52": _("First credit of cheques, vouchers, luncheon vouchers, postal orders, credit under usual reserve"),
- "50": _("Credit of a payment via terminal"),
- "49": _("Cancellation or correction"),
- "39": _("Provisionally unpaid due to other reason than manual presentation"),
- "38": _("Provisionally unpaid"),
- "37": _("Cheque-related costs"),
- "35": _("Cash advance"),
- "19": _("Settlement of credit cards"),
- "17": _("Your certified cheque"),
- "15": _("Your purchase bank cheque"),
- "13": _("Eurocheque written out abroad"),
- "11": _("Department store cheque"),
- "09": _("Unpaid voucher"),
- "07": _("Definitely unpaid cheque"),
- "05": _("Payment of voucher"),
- "03": _("Your purchase by payment card"),
- "01": _("Payment of your cheque"),
- }],
- "04": [_("Cards"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "68": _("Credit after Proton payments"),
- "55": _("Income from payments by GSM"),
- "53": _("Cash deposit at an ATM"),
- "52": _("Loading GSM cards"),
- "51": _("Unloading Proton"),
- "50": _("Credit after a payment at a terminal"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "08": _("Payment by means of a payment card outside the Eurozone"),
- "07": _("Payment by GSM"),
- "06": _("Payment with tank card"),
- "05": _("Loading Proton"),
- "04": _("Cash withdrawal from an ATM"),
- "03": _("Settlement credit cards"),
- "02": _("Payment by means of a payment card within the Eurozone"),
- "01": _("Loading a GSM card"),
- }],
- "05": [_("Direct debit"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "58": _("Reversal"),
- "56": _("Unexecutable reimbursement"),
- "54": _("Reimbursement"),
- "52": _("Credit under usual reserve"),
- "50": _("Credit after collection"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "05": _("Reimbursement"),
- "03": _("Unpaid debt"),
- "01": _("Payment"),
- }],
- "07": [_("Domestic commercial paper"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "86": _("Payment after cession"),
- "64": _("Warrant"),
- "58": _("Remittance of supplier's bill without guarantee"),
- "56": _("Remittance of supplier's bill with guarantee"),
- "54": _("Remittance of commercial paper for discount"),
- "52": _("Remittance of commercial paper - credit under usual reserve"),
- "50": _("Remittance of commercial paper - credit after collection"),
- "49": _("Cancellation or correction"),
- "39": _("Return of an irregular bill of exchange"),
- "37": _("Costs related to commercial paper"),
- "14": _("Warrant fallen due"),
- "12": _("Safe custody"),
- "10": _("Renewal of agreed maturity date"),
- "09": _("Agio on supplier's bill"),
- "08": _("Payment in advance"),
- "07": _("Unpaid commercial paper"),
- "06": _("Extension of maturity date"),
- "05": _("Commercial paper claimed back"),
- "03": _("Payment receipt card"),
- "01": _("Payment commercial paper"),
- }],
- "09": [_("Counter transactions"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Sale of traveller’s cheque"),
- "68": _("Difference in payment"),
- "66": _("Repurchase of petrol coupons"),
- "64": _("Your winning lottery ticket"),
- "62": _("Sale of gold/pieces under usual reserve"),
- "60": _("Sale of foreign bank notes"),
- "58": _("Payment by your branch/agents"),
- "56": _("Reserve"),
- "54": _("Your payment ATM"),
- "52": _("Payment night safe"),
- "50": _("Cash payment"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "25": _("Purchase of traveller’s cheque"),
- "21": _("Cash withdrawal on card (PROTON)"),
- "19": _("Difference in payment"),
- "17": _("Purchase of fiscal stamps"),
- "15": _("Your purchase of lottery tickets"),
- "13": _("Cash withdrawal by your branch or agents"),
- "11": _("Your purchase of luncheon vouchers"),
- "09": _("Purchase of petrol coupons"),
- "07": _("Purchase of gold/pieces"),
- "05": _("Purchase of foreign bank notes"),
- "03": _("Cash withdrawal by card (ATM)"),
- "01": _("Cash withdrawal"),
- }],
- "11": [_("Securities"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Settlement of securities"),
- "68": _("Compensation for missing coupon"),
- "66": _("Retrocession of issue commission"),
- "64": _("Your issue"),
- "62": _("Interim interest on subscription"),
- "58": _("Repayable securities from a deposit or delivered at the counter - credit under usual reserve"),
- "56": _("Reserve"),
- "52": _("Payment of coupons from a deposit or settlement of coupons delivered over the counter - credit under usual reserve"),
- "51": _("Tender"),
- "50": _("Sale of securities"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "19": _("Regularisation costs"),
- "17": _("Management fee"),
- "15": _("Interim interest on subscription"),
- "13": _("Your repurchase of issue"),
- "11": _("Payable coupons/repayable securities"),
- "09": _("Settlement of securities"),
- "06": _("Share option plan – exercising an option"),
- "05": _("Partial payment subscription"),
- "04": _("Issues"),
- "03": _("Subscription to securities"),
- "02": _("Tenders"),
- "01": _("Purchase of securities"),
- }],
- "13": [_("Credit"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Settlement of discount bank acceptance"),
- "68": _("Documentary export credits"),
- "62": _("Term loan"),
- "60": _("Settlement of mortgage loan"),
- "56": _("Subsidy"),
- "55": _("Fixed advance – interest only"),
- "54": _("Fixed advance – capital and interest"),
- "50": _("Settlement of instalment credit"),
- "49": _("Cancellation or correction"),
- "37": _("Credit-related costs"),
- "21": _("Other credit applications"),
- "19": _("Documentary import credits"),
- "15": _("Your repayment hire-purchase and similar claims"),
- "13": _("Settlement of bank acceptances"),
- "11": _("Your repayment mortgage loan"),
- "07": _("Your repayment instalment credits"),
- "05": _("Settlement of fixed advance"),
- "02": _("Long-term loan"),
- "01": _("Short-term loan"),
- }],
- "30": [_("Various transactions"), {
- "99": _("Cancellation or correction"),
- "89": _("Undefined transaction"),
- "87": _("Reimbursement of costs"),
- "83": _("Value (date) correction"),
- "55": _("Interest term investment"),
- "54": _("Capital and/or interest term investment"),
- "52": _("Forward sale of foreign exchange"),
- "50": _("Spot sale of foreign exchange"),
- "49": _("Cancellation or correction"),
- "39": _("Undefined transaction"),
- "37": _("Costs"),
- "33": _("Value (date) correction"),
- "05": _("Capital and/or interest term investment"),
- "03": _("Forward purchase of foreign exchange"),
- "01": _("Spot purchase of foreign exchange"),
- }],
- "35": [_("Closing (periodical settlements for interest, costs,…)"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "50": _("Closing"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "01": _("Closing"),
- }],
- "41": [_("International credit transfers - non-SEPA credit transfers"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "66": _("Financial centralisation (credit)"),
- "64": _("Transfer to your account"),
- "50": _("Transfer"),
- "49": _("Cancellation or correction"),
- "38": _("Costs relating to incoming foreign and non-SEPA transfers"),
- "37": _("Costs relating to outgoing foreign transfers and non-SEPA transfers"),
- "17": _("Financial centralisation (debit)"),
- "13": _("Transfer from your account"),
- "07": _("Collective transfers"),
- "05": _("Collective payments of wages"),
- "03": _("Standing order"),
- "01": _("Transfer"),
- }],
- "43": [_("Foreign cheques"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Purchase of traveller’s cheque"),
- "62": _("Reversal of cheques"),
- "58": _("Remittance of foreign cheque credit after collection"),
- "52": _("Remittance of foreign cheque credit under usual reserve"),
- "49": _("Cancellation or correction"),
- "37": _("Costs relating to payment of foreign cheques"),
- "15": _("Purchase of an international bank cheque"),
- "07": _("Unpaid foreign cheque"),
- "01": _("Payment of a foreign cheque"),
- }],
- "47": [_("Foreign commercial paper"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "64": _("Warrant"),
- "62": _("Remittance of documents abroad - credit after collection"),
- "60": _("Remittance of documents abroad - credit under usual reserve"),
- "58": _("Idem without guarantee"),
- "56": _("Remittance of guaranteed foreign supplier's bill"),
- "54": _("Discount abroad"),
- "52": _("Remittance of foreign bill credit under usual reserve"),
- "50": _("Remittance of foreign bill credit after collection"),
- "49": _("Cancellation or correction"),
- "37": _("Costs relating to the payment of a foreign bill"),
- "14": _("Warrant fallen due"),
- "13": _("Discount foreign supplier's bills"),
- "11": _("Payment documents abroad"),
- "07": _("Unpaid foreign bill"),
- "06": _("Extension"),
- "05": _("Bill claimed back"),
- "01": _("Payment of foreign bill"),
- }],
- "49": [_("Foreign counter transactions"), {"03": _("ATM withdrawal")}],
- "80": [_("Separately charged costs and provisions"), {
- "01": _("Guarantee card charges"),
- "02": _("Costs relating to electronic output"),
- "03": _("Payment card charges"),
- "04": _("Costs for holding a documentary cash credit"),
- "05": _("Card charges"),
- "06": _("Damage relating to bills and cheques"),
- "07": _("Insurance costs"),
- "08": _("Registering compensation for savings accounts"),
- "09": _("Postage"),
- "10": _("Purchase of Smartcard"),
- "11": _("Costs for the safe custody of correspondence"),
- "12": _("Costs for opening a bank guarantee"),
- "13": _("Renting of safes"),
- "14": _("Handling costs instalment credit"),
- "15": _("Night safe"),
- "16": _("Bank confirmation to revisor or accountant"),
- "17": _("Charge for safe custody"),
- "18": _("Trade information"),
- "19": _("Special charge for safe custody"),
- "20": _("Drawing up a certificate"),
- "21": _("Pay-packet charges"),
- "22": _("Management/custody"),
- "23": _("Research costs"),
- "24": _("Participation in and management of interest refund system"),
- "25": _("Renting of direct debit box"),
- "26": _("Travel insurance premium"),
- "27": _("Subscription fee"),
- "29": _("Information charges"),
- "31": _("Writ service fee"),
- "33": _("Miscellaneous fees and commissions"),
- "35": _("Costs"),
- "37": _("Access right to database"),
- "39": _("Surety fee"),
- "41": _("Research costs"),
- "43": _("Printing of forms"),
- "45": _("Documentary credit charges"),
- "47": _("Charging fees for transactions"),
- "49": _("Cancellation or correction"),
- "99": _("Cancellation or correction"),
- }],
-}
-
-transaction_categories = {
- "000": _("Net amount"),
- "001": _("Interest received"),
- "002": _("Interest paid"),
- "003": _("Credit commission"),
- "004": _("Postage"),
- "005": _("Renting of letterbox"),
- "006": _("Various fees/commissions"),
- "007": _("Access right to database"),
- "008": _("Information charges"),
- "009": _("Travelling expenses"),
- "010": _("Writ service fee"),
- "011": _("VAT"),
- "012": _("Exchange commission"),
- "013": _("Payment commission"),
- "014": _("Collection commission"),
- "015": _("Correspondent charges"),
- "016": _("BLIW/IBLC dues"),
- "017": _("Research costs"),
- "018": _("Tental guarantee charges"),
- "019": _("Tax on physical delivery"),
- "020": _("Costs of physical delivery"),
- "021": _("Costs for drawing up a bank cheque"),
- "022": _("Priority costs"),
- "023": _("Exercising fee"),
- "024": _("Growth premium"),
- "025": _("Individual entry for exchange charges"),
- "026": _("Handling commission"),
- "027": _("Charges for unpaid bills"),
- "028": _("Fidelity premium"),
- "029": _("Protest charges"),
- "030": _("Account insurance"),
- "031": _("Charges foreign cheque"),
- "032": _("Drawing up a circular cheque"),
- "033": _("Charges for a foreign bill"),
- "034": _("Reinvestment fee"),
- "035": _("Charges foreign documentary bill"),
- "036": _("Costs relating to a refused cheque"),
- "037": _("Commission for handling charges"),
- "039": _("Telecommunications"),
- "041": _("Credit card costs"),
- "042": _("Payment card costs"),
- "043": _("Insurance costs"),
- "045": _("Handling costs"),
- "047": _("Charges extension bill"),
- "049": _("Fiscal stamps/stamp duty"),
- "050": _("Capital term investment"),
- "051": _("Withholding tax"),
- "052": _("Residence state tax"),
- "053": _("Printing of forms"),
- "055": _("Repayment loan or credit capital"),
- "057": _("Interest subsidy"),
- "058": _("Capital premium"),
- "059": _("Default interest"),
- "061": _("Charging fees for transactions"),
- "063": _("Rounding differences"),
- "065": _("Interest payment advice"),
- "066": _("Fixed loan advance - reimbursement"),
- "067": _("Fixed loan advance - extension"),
- "068": _("Countervalue of an entry"),
- "069": _("Forward arbitrage contracts : sum to be supplied by customer"),
- "070": _("Forward arbitrage contracts : sum to be supplied by bank"),
- "071": _("Fixed loan advance - availability"),
- "072": _("Countervalue of commission to third party"),
- "073": _("Costs of ATM abroad"),
- "074": _("Mailing costs"),
- "100": _("Gross amount"),
- "200": _("Overall documentary credit charges"),
- "201": _("Advice notice commission"),
- "202": _("Advising commission | Additional advising commission"),
- "203": _("Confirmation fee | Additional confirmation fee | Commitment fee | Flat fee | Confirmation reservation commission | Additional reservation commission"),
- "204": _("Amendment fee"),
- "205": _("Documentary payment commission | Document commission | Drawdown fee | Negotiation fee"),
- "206": _("Surety fee/payment under reserve"),
- "207": _("Non-conformity fee"),
- "208": _("Commitment fee deferred payment"),
- "209": _("Transfer commission"),
- "210": _("Commitment fee"),
- "211": _("Credit arrangement fee | Additional credit arrangement fee"),
- "212": _("Warehousing fee"),
- "213": _("Financing fee"),
- "214": _("Issue commission (delivery order)"),
- "400": _("Acceptance fee"),
- "401": _("Visa charges"),
- "402": _("Certification costs"),
- "403": _("Minimum discount rate"),
- "404": _("Discount commission"),
- "405": _("Bill guarantee commission"),
- "406": _("Collection charges"),
- "407": _("Costs Article 45"),
- "408": _("Cover commission"),
- "409": _("Safe deposit charges"),
- "410": _("Reclamation charges"),
- "411": _("Fixed collection charge"),
- "412": _("Advice of expiry charges"),
- "413": _("Acceptance charges"),
- "414": _("Regularisation charges"),
- "415": _("Surety fee"),
- "416": _("Charges for the deposit of security"),
- "418": _("Endorsement commission"),
- "419": _("Bank service fee"),
- "420": _("Retention charges"),
- "425": _("Foreign broker's commission"),
- "426": _("Belgian broker's commission"),
- "427": _("Belgian Stock Exchange tax"),
- "428": _("Interest accrued"),
- "429": _("Foreign Stock Exchange tax"),
- "430": _("Recovery of foreign tax"),
- "431": _("Delivery of a copy"),
-}
-
-
-def rmspaces(s):
- return " ".join(s.split())
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From 819a8f3887ed5ba29930ce40131e4a83648694c9 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Wed, 5 Dec 2012 19:02:02 +0100
Subject: [PATCH 09/32] [FIX]name missing in tree bank statement line
bzr revid: dle@openerp.com-20121205180202-amy4yrqotuu0ta5e
---
addons/account/account_view.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 562c1ad6fa1..235ded29094 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -574,6 +574,7 @@
+
From 28b988940f65d2e114442cfbe57a27a1bac83252 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Wed, 5 Dec 2012 20:21:43 +0100
Subject: [PATCH 10/32] [FIX]Removing _(translate) from transaction code,
family, categories + Matching bank account number
bzr revid: dle@openerp.com-20121205192143-9qxazjf743z42ycw
---
.../wizard/account_coda_import.py | 898 +++++++++---------
1 file changed, 450 insertions(+), 448 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 0bde26e1f44..2286caf8f68 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -45,7 +45,6 @@ class account_coda_import(osv.osv_memory):
if context is None:
context = {}
if batch:
- print
codafile = str(codafile)
codafilename = codafilename
else:
@@ -54,7 +53,7 @@ class account_coda_import(osv.osv_memory):
codafile = data.coda_data
codafilename = data.coda_fname
except:
- raise osv.except_osv(_('Error!'), _('Wizard in incorrect state. Please hit the Cancel button!'))
+ raise osv.except_osv(_('Error'), _('Wizard in incorrect state. Please hit the Cancel button'))
return {}
recordlist = unicode(base64.decodestring(codafile), 'windows-1252', 'strict').split('\n')
statements = []
@@ -67,7 +66,7 @@ class account_coda_import(osv.osv_memory):
statements.append(statement)
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'])
+ 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'))
@@ -75,21 +74,31 @@ class account_coda_import(osv.osv_memory):
elif line[0] == '1':
#Statement details
if statement['version'] == '1':
- statement['accountNumber'] = rmspaces(line[5:17])
+ statement['acc_number'] = rmspaces(line[5:17])
statement['currency'] = rmspaces(line[18:21])
elif statement['version'] == '2':
if line[1] == '0': # Belgian bank account BBAN structure
- statement['accountNumber'] = rmspaces(line[5:17])
+ statement['acc_number'] = rmspaces(line[5:17])
statement['currency'] = rmspaces(line[18:21])
elif line[1] == '1': # foreign bank account BBAN structure
- raise osv.except_osv(_('Error R1001!'), _('Foreign bank accounts with BBAN structure are not supported !'))
+ raise osv.except_osv(_('Error') + 'R1001', _('Foreign bank accounts with BBAN structure are not supported '))
elif line[1] == '2': # Belgian bank account IBAN structure
- statement['accountNumber'] = rmspaces(line[5:21])
+ statement['acc_number'] = rmspaces(line[5:21])
statement['currency'] = rmspaces(line[39:42])
elif line[1] == '3': # foreign bank account IBAN structure
- raise osv.except_osv(_('Error R1002!'), _('Foreign bank accounts with IBAN structure are not supported !'))
+ raise osv.except_osv(_('Error') + 'R1002', _('Foreign bank accounts with IBAN structure are not supported '))
else: # Something else, not supported
- raise osv.except_osv(_('Error R1003!'), _('Unsupported bank account structure !'))
+ raise osv.except_osv(_('Error') + 'R1003', _('Unsupported bank account structure '))
+ ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])])
+ not_found_except = osv.except_osv(_('Error') + 'R1004', _("No matching CODA Bank Account Configuration record found. Please check if the 'Bank Account Number' and 'Currency' fields of your configuration record match with '%s' and '%s'.") % (statement['acc_number'], statement['currency']))
+ if ids and len(ids) > 0:
+ bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, ids)
+ for bank_acc in bank_accs:
+ statement['journal_id'] = bank_acc.journal_id
+ if (statement['journal_id'].currency and statement['journal_id'].currency.name != statement['currency']) and (not statement['journal_id'].currency and statement['journal_id'].company_id.currency_id.name != statement['currency']):
+ raise not_found_except
+ else:
+ raise not_found_except
statement['description'] = rmspaces(line[90:125])
statement['balance_start'] = float(rmspaces(line[43:58])) / 1000
statement['balance_start_date'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[58:64]), '%d%m%y'))
@@ -112,16 +121,12 @@ class account_coda_import(osv.osv_memory):
statementLine['amount'] = - statementLine['amount']
statementLine['transaction_type'] = line[53]
if statementLine['transaction_type'] not in transaction_types:
- raise osv.except_osv(_('Error R2001!'), _('The File contains an invalid CODA Transaction Type : %s!') % statementLine['transaction_type'])
+ raise osv.except_osv(_('Error') + 'R2001', _('The File contains an invalid CODA Transaction Type : %s') % statementLine['transaction_type'])
statementLine['transactionDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[47:53]), '%d%m%y'))
statementLine['transaction_family'] = rmspaces(line[54:56])
- #TODO Handling severals transactions Family
statementLine['transaction_code'] = rmspaces(line[56:58])
- #TODO Handling severals transactions code
statementLine['transaction_category'] = rmspaces(line[58:61])
- #TODO Handling severals transactions category
statementLine['communication'] = rmspaces(line[62:115])
- #TODO Handling structured communication
statementLine['entryDate'] = rmspaces(line[115:121])
statementLine['type'] = 'normal'
statementLine['globalisation'] = int(line[124])
@@ -138,13 +143,13 @@ class account_coda_import(osv.osv_memory):
statement['lines'].append(statementLine)
elif line[1] == '2':
if statement['lines'][-1]['ref'][0:4] != line[2:6]:
- raise osv.except_osv(_('Error R2004!'), _('CODA parsing error on movement data record 2.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ raise osv.except_osv(_('Error') + 'R2004', _('CODA parsing error on movement data record 2.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
statement['lines'][-1]['communication'] += rmspaces(line[10:63])
statement['lines'][-1]['payment_reference'] = rmspaces(line[63:98])
statement['lines'][-1]['counterparty_bic'] = rmspaces(line[98:109])
elif line[1] == '3':
if statement['lines'][-1]['ref'][0:4] != line[2:6]:
- raise osv.except_osv(_('Error R2005!'), _('CODA parsing error on movement data record 2.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ raise osv.except_osv(_('Error') + 'R2005', _('CODA parsing error on movement data record 2.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
if statement['version'] == '1':
statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:125])
@@ -160,7 +165,7 @@ class account_coda_import(osv.osv_memory):
statement['lines'][-1]['communication'] += rmspaces(line[82:125])
else:
# movement data record 2.x (x != 1,2,3)
- raise osv.except_osv(_('Error R2009!'), _('\nMovement data records of type 2.%s are not supported !') % line[1])
+ raise osv.except_osv(_('Error') + 'R2006', _('\nMovement data records of type 2.%s are not supported ') % line[1])
elif line[0] == '3':
if line[1] == '1':
infoLine = {}
@@ -179,11 +184,11 @@ class account_coda_import(osv.osv_memory):
statement['lines'].append(infoLine)
elif line[1] == '2':
if infoLine['ref'] != rmspaces(line[2:10]):
- raise osv.except_osv(_('Error R3004!'), _('CODA parsing error on information data record 3.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ raise osv.except_osv(_('Error') + 'R3004', _('CODA parsing error on information data record 3.2, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
statement['lines'][-1]['communication'] += rmspaces(line[10:100])
elif line[1] == '3':
if infoLine['ref'] != rmspaces(line[2:10]):
- raise osv.except_osv(_('Error R3005!'), _('CODA parsing error on information data record 3.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
+ raise osv.except_osv(_('Error') + 'R3005', _('CODA parsing error on information data record 3.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
statement['lines'][-1]['communication'] += rmspaces(line[10:100])
elif line[0] == '4':
comm_line = {}
@@ -207,7 +212,7 @@ class account_coda_import(osv.osv_memory):
else:
period_id = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', statement['date']), ('date_stop', '>=', statement['date'])])
if not period_id and len(period_id) == 0:
- raise osv.except_osv(_('Error R0002!'), _("The CODA Statement New Balance date doesn't fall within a defined Accounting Period! Please create the Accounting Period for date %s.") % statement['balance_end_realDate'])
+ raise osv.except_osv(_('Error') + 'R0002', _("The CODA Statement New Balance date doesn't fall within a defined Accounting Period! Please create the Accounting Period for date %s.") % statement['balance_end_realDate'])
statement['period_id'] = period_id[0]
elif line[0] == '9':
statement['balanceMin'] = float(rmspaces(line[22:37])) / 1000
@@ -215,16 +220,13 @@ class account_coda_import(osv.osv_memory):
if not statement['balance_end_real']:
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
for i, statement in enumerate(statements):
- # print '---STATEMENT #' + str(i) + '---'
- print statement
data = {
'name': '[' + statement['date'] + ']' + statement['description'],
'date': statement['date'],
- 'journal_id': 18,
+ 'journal_id': statement['journal_id'].id,
'period_id': statement['period_id'],
'balance_start': statement['balance_start'],
'balance_end_real': statement['balance_end_real'],
- 'account_id': 1
}
statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
for line in statement['lines']:
@@ -264,7 +266,7 @@ class account_coda_import(osv.osv_memory):
if 'counterpartyNumber' in line and line['counterpartyNumber']:
ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
if ids and len(ids) > 0:
- partner_id = self.pool.get('res.partner.bank').browse(cr, uid, ids[0],context=context).partner_id.id
+ partner_id = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id.id
else:
partner_id = None
@@ -275,7 +277,7 @@ class account_coda_import(osv.osv_memory):
'amount': line['amount'],
# 'type': '',
'partner_id': partner_id,
- 'account_id': 1,
+ 'account_id': 1, # TODO
'statement_id': statement['id'],
# 'analytic_account_id': '',
# 'move_ids': '',
@@ -287,449 +289,449 @@ class account_coda_import(osv.osv_memory):
account_coda_import()
transaction_types = {
- "0": ["", _("Simple amount without detailed data; e.g. : an individual credit transfer [free of charges].")],
- "1": ["", _("Amount as totalised by the customer; e.g. a file regrouping payments of wages or payments made to suppliers or a file regrouping collections for which the customer is ]debited or credited with one single amount. As a matter of principle, this type is also used when no detailed data is following [type 5].")],
- "5": ["1", _("Detail of 1. Standard procedure is no detailing. However, the customer may ask for detailed data to be included into his file after the overall record [type 1].")],
- "2": ["", _("Amount as totalised by the bank; e.g. : the total amount of a series of credit transfers with a structured communication As a matter of principle, this type will also be used when no detailed data [type 6 or 7] is following.")],
- "6": ["2", _("Detail of 2. Simple amount without detailed data. Normally, data of this kind comes after type 2. The customer may ask for a separate file containing the detailed data. In that case, one will speak of a ‘separate application’. The records in a separate application keep type 6.")],
- "7": ["2", _("Detail of 2. Simple account with detailed data The records in a separate application keep type 7.")],
- "9": ["7", _("Detail of 7. The records in a separate application keep type 9.")],
- "3": ["", _("Simple amount with detailed data; e.g. in case of charges for cross-border credit transfers.")],
- "8": ["3", _("Detail of 3.")],
+ "0": ["", "Simple amount without detailed data; e.g. : an individual credit transfer [free of charges]."],
+ "1": ["", "Amount as totalised by the customer; e.g. a file regrouping payments of wages or payments made to suppliers or a file regrouping collections for which the customer is ]debited or credited with one single amount. As a matter of principle, this type is also used when no detailed data is following [type 5]."],
+ "5": ["1", "Detail of 1. Standard procedure is no detailing. However, the customer may ask for detailed data to be included into his file after the overall record [type 1]."],
+ "2": ["", "Amount as totalised by the bank; e.g. : the total amount of a series of credit transfers with a structured communication As a matter of principle, this type will also be used when no detailed data [type 6 or 7] is following."],
+ "6": ["2", "Detail of 2. Simple amount without detailed data. Normally, data of this kind comes after type 2. The customer may ask for a separate file containing the detailed data. In that case, one will speak of a ‘separate application’. The records in a separate application keep type 6."],
+ "7": ["2", "Detail of 2. Simple account with detailed data The records in a separate application keep type 7."],
+ "9": ["7", "Detail of 7. The records in a separate application keep type 9."],
+ "3": ["", "Simple amount with detailed data; e.g. in case of charges for cross-border credit transfers."],
+ "8": ["3", "Detail of 3."],
}
transaction_codes = {
- "00": [_("Undefined transactions"), {
- "89": _("Cancellation of a transaction"),
- "87": _("Costs refunded"),
- "85": _("Correction"),
- "83": _("Value correction"),
- "39": _("Cancellation of a transaction"),
- "37": _("Costs"),
- "35": _("Correction"),
- "33": _("Value correction"),
- "00": _("Undefined transaction")
+ "00": ["Undefined transactions", {
+ "89": "Cancellation of a transaction",
+ "87": "Costs refunded",
+ "85": "Correction",
+ "83": "Value correction",
+ "39": "Cancellation of a transaction",
+ "37": "Costs",
+ "35": "Correction",
+ "33": "Value correction",
+ "00": "Undefined transaction",
}],
- "01": [_("Domestic or local SEPA credit transfers"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "66": _("Financial centralization"),
- "64": _("Transfer to your account"),
- "62": _("Unpaid postal order"),
- "60": _("Non-presented circular cheque"),
- "54": _("Unexecutable transfer order"),
- "52": _("Payment in your favour"),
- "51": _("Transfer in your favour – initiated by the bank"),
- "50": _("Transfer in your favour"),
- "49": _("Cancellation or correction"),
- "39": _("Your issue circular cheque"),
- "37": _("Costs"),
- "17": _("Financial centralisation"),
- "15": _("Balance due insurance premium"),
- "13": _("Transfer from your account"),
- "11": _("Your semi-standing order – payment to employees"),
- "09": _("Your semi-standing order"),
- "07": _("Collective transfer"),
- "05": _("Payment of wages etc."),
- "03": _("Standing order"),
- "02": _("Individual transfer order initiated by the bank"),
- "01": _("Individual transfer order]"),
+ "01": ["Domestic or local SEPA credit transfers", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "66": "Financial centralization",
+ "64": "Transfer to your account",
+ "62": "Unpaid postal order",
+ "60": "Non-presented circular cheque",
+ "54": "Unexecutable transfer order",
+ "52": "Payment in your favour",
+ "51": "Transfer in your favour – initiated by the bank",
+ "50": "Transfer in your favour",
+ "49": "Cancellation or correction",
+ "39": "Your issue circular cheque",
+ "37": "Costs",
+ "17": "Financial centralisation",
+ "15": "Balance due insurance premium",
+ "13": "Transfer from your account",
+ "11": "Your semi-standing order – payment to employees",
+ "09": "Your semi-standing order",
+ "07": "Collective transfer",
+ "05": "Payment of wages etc.",
+ "03": "Standing order",
+ "02": "Individual transfer order initiated by the bank",
+ "01": "Individual transfer order",
}],
- "03": [_("Cheques"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of cheque-related costs"),
- "68": _("Credit of a payment via electronic purse"),
- "66": _("Remittance of cheque by your branch - credit under usual reserve"),
- "64": _("Reversal of settlement of credit card"),
- "63": _("Second credit of unpaid cheque"),
- "62": _("Reversal of cheque"),
- "60": _("Reversal of voucher"),
- "58": _("Remittance of cheques, vouchers, etc. credit after collection"),
- "56": _("Non-presented certified cheques"),
- "52": _("First credit of cheques, vouchers, luncheon vouchers, postal orders, credit under usual reserve"),
- "50": _("Credit of a payment via terminal"),
- "49": _("Cancellation or correction"),
- "39": _("Provisionally unpaid due to other reason than manual presentation"),
- "38": _("Provisionally unpaid"),
- "37": _("Cheque-related costs"),
- "35": _("Cash advance"),
- "19": _("Settlement of credit cards"),
- "17": _("Your certified cheque"),
- "15": _("Your purchase bank cheque"),
- "13": _("Eurocheque written out abroad"),
- "11": _("Department store cheque"),
- "09": _("Unpaid voucher"),
- "07": _("Definitely unpaid cheque"),
- "05": _("Payment of voucher"),
- "03": _("Your purchase by payment card"),
- "01": _("Payment of your cheque"),
+ "03": ["Cheques", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of cheque-related costs",
+ "68": "Credit of a payment via electronic purse",
+ "66": "Remittance of cheque by your branch - credit under usual reserve",
+ "64": "Reversal of settlement of credit card",
+ "63": "Second credit of unpaid cheque",
+ "62": "Reversal of cheque",
+ "60": "Reversal of voucher",
+ "58": "Remittance of cheques, vouchers, etc. credit after collection",
+ "56": "Non-presented certified cheques",
+ "52": "First credit of cheques, vouchers, luncheon vouchers, postal orders, credit under usual reserve",
+ "50": "Credit of a payment via terminal",
+ "49": "Cancellation or correction",
+ "39": "Provisionally unpaid due to other reason than manual presentation",
+ "38": "Provisionally unpaid",
+ "37": "Cheque-related costs",
+ "35": "Cash advance",
+ "19": "Settlement of credit cards",
+ "17": "Your certified cheque",
+ "15": "Your purchase bank cheque",
+ "13": "Eurocheque written out abroad",
+ "11": "Department store cheque",
+ "09": "Unpaid voucher",
+ "07": "Definitely unpaid cheque",
+ "05": "Payment of voucher",
+ "03": "Your purchase by payment card",
+ "01": "Payment of your cheque",
}],
- "04": [_("Cards"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "68": _("Credit after Proton payments"),
- "55": _("Income from payments by GSM"),
- "53": _("Cash deposit at an ATM"),
- "52": _("Loading GSM cards"),
- "51": _("Unloading Proton"),
- "50": _("Credit after a payment at a terminal"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "08": _("Payment by means of a payment card outside the Eurozone"),
- "07": _("Payment by GSM"),
- "06": _("Payment with tank card"),
- "05": _("Loading Proton"),
- "04": _("Cash withdrawal from an ATM"),
- "03": _("Settlement credit cards"),
- "02": _("Payment by means of a payment card within the Eurozone"),
- "01": _("Loading a GSM card"),
+ "04": ["Cards", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "68": "Credit after Proton payments",
+ "55": "Income from payments by GSM",
+ "53": "Cash deposit at an ATM",
+ "52": "Loading GSM cards",
+ "51": "Unloading Proton",
+ "50": "Credit after a payment at a terminal",
+ "49": "Cancellation or correction",
+ "37": "Costs",
+ "08": "Payment by means of a payment card outside the Eurozone",
+ "07": "Payment by GSM",
+ "06": "Payment with tank card",
+ "05": "Loading Proton",
+ "04": "Cash withdrawal from an ATM",
+ "03": "Settlement credit cards",
+ "02": "Payment by means of a payment card within the Eurozone",
+ "01": "Loading a GSM card",
}],
- "05": [_("Direct debit"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "58": _("Reversal"),
- "56": _("Unexecutable reimbursement"),
- "54": _("Reimbursement"),
- "52": _("Credit under usual reserve"),
- "50": _("Credit after collection"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "05": _("Reimbursement"),
- "03": _("Unpaid debt"),
- "01": _("Payment"),
+ "05": ["Direct debit", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "58": "Reversal",
+ "56": "Unexecutable reimbursement",
+ "54": "Reimbursement",
+ "52": "Credit under usual reserve",
+ "50": "Credit after collection",
+ "49": "Cancellation or correction",
+ "37": "Costs",
+ "05": "Reimbursement",
+ "03": "Unpaid debt",
+ "01": "Payment",
}],
- "07": [_("Domestic commercial paper"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "86": _("Payment after cession"),
- "64": _("Warrant"),
- "58": _("Remittance of supplier's bill without guarantee"),
- "56": _("Remittance of supplier's bill with guarantee"),
- "54": _("Remittance of commercial paper for discount"),
- "52": _("Remittance of commercial paper - credit under usual reserve"),
- "50": _("Remittance of commercial paper - credit after collection"),
- "49": _("Cancellation or correction"),
- "39": _("Return of an irregular bill of exchange"),
- "37": _("Costs related to commercial paper"),
- "14": _("Warrant fallen due"),
- "12": _("Safe custody"),
- "10": _("Renewal of agreed maturity date"),
- "09": _("Agio on supplier's bill"),
- "08": _("Payment in advance"),
- "07": _("Unpaid commercial paper"),
- "06": _("Extension of maturity date"),
- "05": _("Commercial paper claimed back"),
- "03": _("Payment receipt card"),
- "01": _("Payment commercial paper"),
+ "07": ["Domestic commercial paper", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "86": "Payment after cession",
+ "64": "Warrant",
+ "58": "Remittance of supplier's bill without guarantee",
+ "56": "Remittance of supplier's bill with guarantee",
+ "54": "Remittance of commercial paper for discount",
+ "52": "Remittance of commercial paper - credit under usual reserve",
+ "50": "Remittance of commercial paper - credit after collection",
+ "49": "Cancellation or correction",
+ "39": "Return of an irregular bill of exchange",
+ "37": "Costs related to commercial paper",
+ "14": "Warrant fallen due",
+ "12": "Safe custody",
+ "10": "Renewal of agreed maturity date",
+ "09": "Agio on supplier's bill",
+ "08": "Payment in advance",
+ "07": "Unpaid commercial paper",
+ "06": "Extension of maturity date",
+ "05": "Commercial paper claimed back",
+ "03": "Payment receipt card",
+ "01": "Payment commercial paper",
}],
- "09": [_("Counter transactions"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Sale of traveller’s cheque"),
- "68": _("Difference in payment"),
- "66": _("Repurchase of petrol coupons"),
- "64": _("Your winning lottery ticket"),
- "62": _("Sale of gold/pieces under usual reserve"),
- "60": _("Sale of foreign bank notes"),
- "58": _("Payment by your branch/agents"),
- "56": _("Reserve"),
- "54": _("Your payment ATM"),
- "52": _("Payment night safe"),
- "50": _("Cash payment"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "25": _("Purchase of traveller’s cheque"),
- "21": _("Cash withdrawal on card (PROTON)"),
- "19": _("Difference in payment"),
- "17": _("Purchase of fiscal stamps"),
- "15": _("Your purchase of lottery tickets"),
- "13": _("Cash withdrawal by your branch or agents"),
- "11": _("Your purchase of luncheon vouchers"),
- "09": _("Purchase of petrol coupons"),
- "07": _("Purchase of gold/pieces"),
- "05": _("Purchase of foreign bank notes"),
- "03": _("Cash withdrawal by card (ATM)"),
- "01": _("Cash withdrawal"),
+ "09": ["Counter transactions", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "70": "Sale of traveller’s cheque",
+ "68": "Difference in payment",
+ "66": "Repurchase of petrol coupons",
+ "64": "Your winning lottery ticket",
+ "62": "Sale of gold/pieces under usual reserve",
+ "60": "Sale of foreign bank notes",
+ "58": "Payment by your branch/agents",
+ "56": "Reserve",
+ "54": "Your payment ATM",
+ "52": "Payment night safe",
+ "50": "Cash payment",
+ "49": "Cancellation or correction",
+ "37": "Costs",
+ "25": "Purchase of traveller’s cheque",
+ "21": "Cash withdrawal on card (PROTON)",
+ "19": "Difference in payment",
+ "17": "Purchase of fiscal stamps",
+ "15": "Your purchase of lottery tickets",
+ "13": "Cash withdrawal by your branch or agents",
+ "11": "Your purchase of luncheon vouchers",
+ "09": "Purchase of petrol coupons",
+ "07": "Purchase of gold/pieces",
+ "05": "Purchase of foreign bank notes",
+ "03": "Cash withdrawal by card (ATM)",
+ "01": "Cash withdrawal",
}],
- "11": [_("Securities"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Settlement of securities"),
- "68": _("Compensation for missing coupon"),
- "66": _("Retrocession of issue commission"),
- "64": _("Your issue"),
- "62": _("Interim interest on subscription"),
- "58": _("Repayable securities from a deposit or delivered at the counter - credit under usual reserve"),
- "56": _("Reserve"),
- "52": _("Payment of coupons from a deposit or settlement of coupons delivered over the counter - credit under usual reserve"),
- "51": _("Tender"),
- "50": _("Sale of securities"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "19": _("Regularisation costs"),
- "17": _("Management fee"),
- "15": _("Interim interest on subscription"),
- "13": _("Your repurchase of issue"),
- "11": _("Payable coupons/repayable securities"),
- "09": _("Settlement of securities"),
- "06": _("Share option plan – exercising an option"),
- "05": _("Partial payment subscription"),
- "04": _("Issues"),
- "03": _("Subscription to securities"),
- "02": _("Tenders"),
- "01": _("Purchase of securities"),
+ "11": ["Securities", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "70": "Settlement of securities",
+ "68": "Compensation for missing coupon",
+ "66": "Retrocession of issue commission",
+ "64": "Your issue",
+ "62": "Interim interest on subscription",
+ "58": "Repayable securities from a deposit or delivered at the counter - credit under usual reserve",
+ "56": "Reserve",
+ "52": "Payment of coupons from a deposit or settlement of coupons delivered over the counter - credit under usual reserve",
+ "51": "Tender",
+ "50": "Sale of securities",
+ "49": "Cancellation or correction",
+ "37": "Costs",
+ "19": "Regularisation costs",
+ "17": "Management fee",
+ "15": "Interim interest on subscription",
+ "13": "Your repurchase of issue",
+ "11": "Payable coupons/repayable securities",
+ "09": "Settlement of securities",
+ "06": "Share option plan – exercising an option",
+ "05": "Partial payment subscription",
+ "04": "Issues",
+ "03": "Subscription to securities",
+ "02": "Tenders",
+ "01": "Purchase of securities",
}],
- "13": [_("Credit"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Settlement of discount bank acceptance"),
- "68": _("Documentary export credits"),
- "62": _("Term loan"),
- "60": _("Settlement of mortgage loan"),
- "56": _("Subsidy"),
- "55": _("Fixed advance – interest only"),
- "54": _("Fixed advance – capital and interest"),
- "50": _("Settlement of instalment credit"),
- "49": _("Cancellation or correction"),
- "37": _("Credit-related costs"),
- "21": _("Other credit applications"),
- "19": _("Documentary import credits"),
- "15": _("Your repayment hire-purchase and similar claims"),
- "13": _("Settlement of bank acceptances"),
- "11": _("Your repayment mortgage loan"),
- "07": _("Your repayment instalment credits"),
- "05": _("Settlement of fixed advance"),
- "02": _("Long-term loan"),
- "01": _("Short-term loan"),
+ "13": ["Credit", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "70": "Settlement of discount bank acceptance",
+ "68": "Documentary export credits",
+ "62": "Term loan",
+ "60": "Settlement of mortgage loan",
+ "56": "Subsidy",
+ "55": "Fixed advance – interest only",
+ "54": "Fixed advance – capital and interest",
+ "50": "Settlement of instalment credit",
+ "49": "Cancellation or correction",
+ "37": "Credit-related costs",
+ "21": "Other credit applications",
+ "19": "Documentary import credits",
+ "15": "Your repayment hire-purchase and similar claims",
+ "13": "Settlement of bank acceptances",
+ "11": "Your repayment mortgage loan",
+ "07": "Your repayment instalment credits",
+ "05": "Settlement of fixed advance",
+ "02": "Long-term loan",
+ "01": "Short-term loan",
}],
- "30": [_("Various transactions"), {
- "99": _("Cancellation or correction"),
- "89": _("Undefined transaction"),
- "87": _("Reimbursement of costs"),
- "83": _("Value (date) correction"),
- "55": _("Interest term investment"),
- "54": _("Capital and/or interest term investment"),
- "52": _("Forward sale of foreign exchange"),
- "50": _("Spot sale of foreign exchange"),
- "49": _("Cancellation or correction"),
- "39": _("Undefined transaction"),
- "37": _("Costs"),
- "33": _("Value (date) correction"),
- "05": _("Capital and/or interest term investment"),
- "03": _("Forward purchase of foreign exchange"),
- "01": _("Spot purchase of foreign exchange"),
+ "30": ["Various transactions", {
+ "99": "Cancellation or correction",
+ "89": "Undefined transaction",
+ "87": "Reimbursement of costs",
+ "83": "Value (date) correction",
+ "55": "Interest term investment",
+ "54": "Capital and/or interest term investment",
+ "52": "Forward sale of foreign exchange",
+ "50": "Spot sale of foreign exchange",
+ "49": "Cancellation or correction",
+ "39": "Undefined transaction",
+ "37": "Costs",
+ "33": "Value (date) correction",
+ "05": "Capital and/or interest term investment",
+ "03": "Forward purchase of foreign exchange",
+ "01": "Spot purchase of foreign exchange",
}],
- "35": [_("Closing (periodical settlements for interest, costs,…)"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "50": _("Closing"),
- "49": _("Cancellation or correction"),
- "37": _("Costs"),
- "01": _("Closing"),
+ "35": ["Closing (periodical settlements for interest, costs,…)", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "50": "Closing",
+ "49": "Cancellation or correction",
+ "37": "Costs",
+ "01": "Closing",
}],
- "41": [_("International credit transfers - non-SEPA credit transfers"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "66": _("Financial centralisation (credit)"),
- "64": _("Transfer to your account"),
- "50": _("Transfer"),
- "49": _("Cancellation or correction"),
- "38": _("Costs relating to incoming foreign and non-SEPA transfers"),
- "37": _("Costs relating to outgoing foreign transfers and non-SEPA transfers"),
- "17": _("Financial centralisation (debit)"),
- "13": _("Transfer from your account"),
- "07": _("Collective transfers"),
- "05": _("Collective payments of wages"),
- "03": _("Standing order"),
- "01": _("Transfer"),
+ "41": ["International credit transfers - non-SEPA credit transfers", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "66": "Financial centralisation (credit)",
+ "64": "Transfer to your account",
+ "50": "Transfer",
+ "49": "Cancellation or correction",
+ "38": "Costs relating to incoming foreign and non-SEPA transfers",
+ "37": "Costs relating to outgoing foreign transfers and non-SEPA transfers",
+ "17": "Financial centralisation (debit)",
+ "13": "Transfer from your account",
+ "07": "Collective transfers",
+ "05": "Collective payments of wages",
+ "03": "Standing order",
+ "01": "Transfer",
}],
- "43": [_("Foreign cheques"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "70": _("Purchase of traveller’s cheque"),
- "62": _("Reversal of cheques"),
- "58": _("Remittance of foreign cheque credit after collection"),
- "52": _("Remittance of foreign cheque credit under usual reserve"),
- "49": _("Cancellation or correction"),
- "37": _("Costs relating to payment of foreign cheques"),
- "15": _("Purchase of an international bank cheque"),
- "07": _("Unpaid foreign cheque"),
- "01": _("Payment of a foreign cheque"),
+ "43": ["Foreign cheques", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "70": "Purchase of traveller’s cheque",
+ "62": "Reversal of cheques",
+ "58": "Remittance of foreign cheque credit after collection",
+ "52": "Remittance of foreign cheque credit under usual reserve",
+ "49": "Cancellation or correction",
+ "37": "Costs relating to payment of foreign cheques",
+ "15": "Purchase of an international bank cheque",
+ "07": "Unpaid foreign cheque",
+ "01": "Payment of a foreign cheque",
}],
- "47": [_("Foreign commercial paper"), {
- "99": _("Cancellation or correction"),
- "87": _("Reimbursement of costs"),
- "64": _("Warrant"),
- "62": _("Remittance of documents abroad - credit after collection"),
- "60": _("Remittance of documents abroad - credit under usual reserve"),
- "58": _("Idem without guarantee"),
- "56": _("Remittance of guaranteed foreign supplier's bill"),
- "54": _("Discount abroad"),
- "52": _("Remittance of foreign bill credit under usual reserve"),
- "50": _("Remittance of foreign bill credit after collection"),
- "49": _("Cancellation or correction"),
- "37": _("Costs relating to the payment of a foreign bill"),
- "14": _("Warrant fallen due"),
- "13": _("Discount foreign supplier's bills"),
- "11": _("Payment documents abroad"),
- "07": _("Unpaid foreign bill"),
- "06": _("Extension"),
- "05": _("Bill claimed back"),
- "01": _("Payment of foreign bill"),
+ "47": ["Foreign commercial paper", {
+ "99": "Cancellation or correction",
+ "87": "Reimbursement of costs",
+ "64": "Warrant",
+ "62": "Remittance of documents abroad - credit after collection",
+ "60": "Remittance of documents abroad - credit under usual reserve",
+ "58": "Idem without guarantee",
+ "56": "Remittance of guaranteed foreign supplier's bill",
+ "54": "Discount abroad",
+ "52": "Remittance of foreign bill credit under usual reserve",
+ "50": "Remittance of foreign bill credit after collection",
+ "49": "Cancellation or correction",
+ "37": "Costs relating to the payment of a foreign bill",
+ "14": "Warrant fallen due",
+ "13": "Discount foreign supplier's bills",
+ "11": "Payment documents abroad",
+ "07": "Unpaid foreign bill",
+ "06": "Extension",
+ "05": "Bill claimed back",
+ "01": "Payment of foreign bill",
}],
- "49": [_("Foreign counter transactions"), {"03": _("ATM withdrawal")}],
- "80": [_("Separately charged costs and provisions"), {
- "01": _("Guarantee card charges"),
- "02": _("Costs relating to electronic output"),
- "03": _("Payment card charges"),
- "04": _("Costs for holding a documentary cash credit"),
- "05": _("Card charges"),
- "06": _("Damage relating to bills and cheques"),
- "07": _("Insurance costs"),
- "08": _("Registering compensation for savings accounts"),
- "09": _("Postage"),
- "10": _("Purchase of Smartcard"),
- "11": _("Costs for the safe custody of correspondence"),
- "12": _("Costs for opening a bank guarantee"),
- "13": _("Renting of safes"),
- "14": _("Handling costs instalment credit"),
- "15": _("Night safe"),
- "16": _("Bank confirmation to revisor or accountant"),
- "17": _("Charge for safe custody"),
- "18": _("Trade information"),
- "19": _("Special charge for safe custody"),
- "20": _("Drawing up a certificate"),
- "21": _("Pay-packet charges"),
- "22": _("Management/custody"),
- "23": _("Research costs"),
- "24": _("Participation in and management of interest refund system"),
- "25": _("Renting of direct debit box"),
- "26": _("Travel insurance premium"),
- "27": _("Subscription fee"),
- "29": _("Information charges"),
- "31": _("Writ service fee"),
- "33": _("Miscellaneous fees and commissions"),
- "35": _("Costs"),
- "37": _("Access right to database"),
- "39": _("Surety fee"),
- "41": _("Research costs"),
- "43": _("Printing of forms"),
- "45": _("Documentary credit charges"),
- "47": _("Charging fees for transactions"),
- "49": _("Cancellation or correction"),
- "99": _("Cancellation or correction"),
+ "49": ["Foreign counter transactions", {"03": "ATM withdrawal"}],
+ "80": ["Separately charged costs and provisions", {
+ "01": "Guarantee card charges",
+ "02": "Costs relating to electronic output",
+ "03": "Payment card charges",
+ "04": "Costs for holding a documentary cash credit",
+ "05": "Card charges",
+ "06": "Damage relating to bills and cheques",
+ "07": "Insurance costs",
+ "08": "Registering compensation for savings accounts",
+ "09": "Postage",
+ "10": "Purchase of Smartcard",
+ "11": "Costs for the safe custody of correspondence",
+ "12": "Costs for opening a bank guarantee",
+ "13": "Renting of safes",
+ "14": "Handling costs instalment credit",
+ "15": "Night safe",
+ "16": "Bank confirmation to revisor or accountant",
+ "17": "Charge for safe custody",
+ "18": "Trade information",
+ "19": "Special charge for safe custody",
+ "20": "Drawing up a certificate",
+ "21": "Pay-packet charges",
+ "22": "Management/custody",
+ "23": "Research costs",
+ "24": "Participation in and management of interest refund system",
+ "25": "Renting of direct debit box",
+ "26": "Travel insurance premium",
+ "27": "Subscription fee",
+ "29": "Information charges",
+ "31": "Writ service fee",
+ "33": "Miscellaneous fees and commissions",
+ "35": "Costs",
+ "37": "Access right to database",
+ "39": "Surety fee",
+ "41": "Research costs",
+ "43": "Printing of forms",
+ "45": "Documentary credit charges",
+ "47": "Charging fees for transactions",
+ "49": "Cancellation or correction",
+ "99": "Cancellation or correction",
}],
}
transaction_categories = {
- "000": _("Net amount"),
- "001": _("Interest received"),
- "002": _("Interest paid"),
- "003": _("Credit commission"),
- "004": _("Postage"),
- "005": _("Renting of letterbox"),
- "006": _("Various fees/commissions"),
- "007": _("Access right to database"),
- "008": _("Information charges"),
- "009": _("Travelling expenses"),
- "010": _("Writ service fee"),
- "011": _("VAT"),
- "012": _("Exchange commission"),
- "013": _("Payment commission"),
- "014": _("Collection commission"),
- "015": _("Correspondent charges"),
- "016": _("BLIW/IBLC dues"),
- "017": _("Research costs"),
- "018": _("Tental guarantee charges"),
- "019": _("Tax on physical delivery"),
- "020": _("Costs of physical delivery"),
- "021": _("Costs for drawing up a bank cheque"),
- "022": _("Priority costs"),
- "023": _("Exercising fee"),
- "024": _("Growth premium"),
- "025": _("Individual entry for exchange charges"),
- "026": _("Handling commission"),
- "027": _("Charges for unpaid bills"),
- "028": _("Fidelity premium"),
- "029": _("Protest charges"),
- "030": _("Account insurance"),
- "031": _("Charges foreign cheque"),
- "032": _("Drawing up a circular cheque"),
- "033": _("Charges for a foreign bill"),
- "034": _("Reinvestment fee"),
- "035": _("Charges foreign documentary bill"),
- "036": _("Costs relating to a refused cheque"),
- "037": _("Commission for handling charges"),
- "039": _("Telecommunications"),
- "041": _("Credit card costs"),
- "042": _("Payment card costs"),
- "043": _("Insurance costs"),
- "045": _("Handling costs"),
- "047": _("Charges extension bill"),
- "049": _("Fiscal stamps/stamp duty"),
- "050": _("Capital term investment"),
- "051": _("Withholding tax"),
- "052": _("Residence state tax"),
- "053": _("Printing of forms"),
- "055": _("Repayment loan or credit capital"),
- "057": _("Interest subsidy"),
- "058": _("Capital premium"),
- "059": _("Default interest"),
- "061": _("Charging fees for transactions"),
- "063": _("Rounding differences"),
- "065": _("Interest payment advice"),
- "066": _("Fixed loan advance - reimbursement"),
- "067": _("Fixed loan advance - extension"),
- "068": _("Countervalue of an entry"),
- "069": _("Forward arbitrage contracts : sum to be supplied by customer"),
- "070": _("Forward arbitrage contracts : sum to be supplied by bank"),
- "071": _("Fixed loan advance - availability"),
- "072": _("Countervalue of commission to third party"),
- "073": _("Costs of ATM abroad"),
- "074": _("Mailing costs"),
- "100": _("Gross amount"),
- "200": _("Overall documentary credit charges"),
- "201": _("Advice notice commission"),
- "202": _("Advising commission | Additional advising commission"),
- "203": _("Confirmation fee | Additional confirmation fee | Commitment fee | Flat fee | Confirmation reservation commission | Additional reservation commission"),
- "204": _("Amendment fee"),
- "205": _("Documentary payment commission | Document commission | Drawdown fee | Negotiation fee"),
- "206": _("Surety fee/payment under reserve"),
- "207": _("Non-conformity fee"),
- "208": _("Commitment fee deferred payment"),
- "209": _("Transfer commission"),
- "210": _("Commitment fee"),
- "211": _("Credit arrangement fee | Additional credit arrangement fee"),
- "212": _("Warehousing fee"),
- "213": _("Financing fee"),
- "214": _("Issue commission (delivery order)"),
- "400": _("Acceptance fee"),
- "401": _("Visa charges"),
- "402": _("Certification costs"),
- "403": _("Minimum discount rate"),
- "404": _("Discount commission"),
- "405": _("Bill guarantee commission"),
- "406": _("Collection charges"),
- "407": _("Costs Article 45"),
- "408": _("Cover commission"),
- "409": _("Safe deposit charges"),
- "410": _("Reclamation charges"),
- "411": _("Fixed collection charge"),
- "412": _("Advice of expiry charges"),
- "413": _("Acceptance charges"),
- "414": _("Regularisation charges"),
- "415": _("Surety fee"),
- "416": _("Charges for the deposit of security"),
- "418": _("Endorsement commission"),
- "419": _("Bank service fee"),
- "420": _("Retention charges"),
- "425": _("Foreign broker's commission"),
- "426": _("Belgian broker's commission"),
- "427": _("Belgian Stock Exchange tax"),
- "428": _("Interest accrued"),
- "429": _("Foreign Stock Exchange tax"),
- "430": _("Recovery of foreign tax"),
- "431": _("Delivery of a copy"),
+ "000": "Net amount",
+ "001": "Interest received",
+ "002": "Interest paid",
+ "003": "Credit commission",
+ "004": "Postage",
+ "005": "Renting of letterbox",
+ "006": "Various fees/commissions",
+ "007": "Access right to database",
+ "008": "Information charges",
+ "009": "Travelling expenses",
+ "010": "Writ service fee",
+ "011": "VAT",
+ "012": "Exchange commission",
+ "013": "Payment commission",
+ "014": "Collection commission",
+ "015": "Correspondent charges",
+ "016": "BLIW/IBLC dues",
+ "017": "Research costs",
+ "018": "Tental guarantee charges",
+ "019": "Tax on physical delivery",
+ "020": "Costs of physical delivery",
+ "021": "Costs for drawing up a bank cheque",
+ "022": "Priority costs",
+ "023": "Exercising fee",
+ "024": "Growth premium",
+ "025": "Individual entry for exchange charges",
+ "026": "Handling commission",
+ "027": "Charges for unpaid bills",
+ "028": "Fidelity premium",
+ "029": "Protest charges",
+ "030": "Account insurance",
+ "031": "Charges foreign cheque",
+ "032": "Drawing up a circular cheque",
+ "033": "Charges for a foreign bill",
+ "034": "Reinvestment fee",
+ "035": "Charges foreign documentary bill",
+ "036": "Costs relating to a refused cheque",
+ "037": "Commission for handling charges",
+ "039": "Telecommunications",
+ "041": "Credit card costs",
+ "042": "Payment card costs",
+ "043": "Insurance costs",
+ "045": "Handling costs",
+ "047": "Charges extension bill",
+ "049": "Fiscal stamps/stamp duty",
+ "050": "Capital term investment",
+ "051": "Withholding tax",
+ "052": "Residence state tax",
+ "053": "Printing of forms",
+ "055": "Repayment loan or credit capital",
+ "057": "Interest subsidy",
+ "058": "Capital premium",
+ "059": "Default interest",
+ "061": "Charging fees for transactions",
+ "063": "Rounding differences",
+ "065": "Interest payment advice",
+ "066": "Fixed loan advance - reimbursement",
+ "067": "Fixed loan advance - extension",
+ "068": "Countervalue of an entry",
+ "069": "Forward arbitrage contracts : sum to be supplied by customer",
+ "070": "Forward arbitrage contracts : sum to be supplied by bank",
+ "071": "Fixed loan advance - availability",
+ "072": "Countervalue of commission to third party",
+ "073": "Costs of ATM abroad",
+ "074": "Mailing costs",
+ "100": "Gross amount",
+ "200": "Overall documentary credit charges",
+ "201": "Advice notice commission",
+ "202": "Advising commission | Additional advising commission",
+ "203": "Confirmation fee | Additional confirmation fee | Commitment fee | Flat fee | Confirmation reservation commission | Additional reservation commission",
+ "204": "Amendment fee",
+ "205": "Documentary payment commission | Document commission | Drawdown fee | Negotiation fee",
+ "206": "Surety fee/payment under reserve",
+ "207": "Non-conformity fee",
+ "208": "Commitment fee deferred payment",
+ "209": "Transfer commission",
+ "210": "Commitment fee",
+ "211": "Credit arrangement fee | Additional credit arrangement fee",
+ "212": "Warehousing fee",
+ "213": "Financing fee",
+ "214": "Issue commission (delivery order)",
+ "400": "Acceptance fee",
+ "401": "Visa charges",
+ "402": "Certification costs",
+ "403": "Minimum discount rate",
+ "404": "Discount commission",
+ "405": "Bill guarantee commission",
+ "406": "Collection charges",
+ "407": "Costs Article 45",
+ "408": "Cover commission",
+ "409": "Safe deposit charges",
+ "410": "Reclamation charges",
+ "411": "Fixed collection charge",
+ "412": "Advice of expiry charges",
+ "413": "Acceptance charges",
+ "414": "Regularisation charges",
+ "415": "Surety fee",
+ "416": "Charges for the deposit of security",
+ "418": "Endorsement commission",
+ "419": "Bank service fee",
+ "420": "Retention charges",
+ "425": "Foreign broker's commission",
+ "426": "Belgian broker's commission",
+ "427": "Belgian Stock Exchange tax",
+ "428": "Interest accrued",
+ "429": "Foreign Stock Exchange tax",
+ "430": "Recovery of foreign tax",
+ "431": "Delivery of a copy",
}
From 7232c1f986718bf9808af4d625dd163637cb3ac1 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 12:18:16 +0100
Subject: [PATCH 11/32] [DEL]Useless dependances + [ADD]Statement journal
depending on bank account, statement line account depending on bank accont or
partner if setted, statement line type
bzr revid: dle@openerp.com-20121206111816-c0t7mfy1x6seezev
---
addons/l10n_be_coda/__openerp__.py | 2 +-
.../wizard/account_coda_import.py | 26 ++++++++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/addons/l10n_be_coda/__openerp__.py b/addons/l10n_be_coda/__openerp__.py
index 14e1bf6e443..0cb29bcc002 100644
--- a/addons/l10n_be_coda/__openerp__.py
+++ b/addons/l10n_be_coda/__openerp__.py
@@ -90,7 +90,7 @@ V2.2 specifications.
If required, you can manually adjust the descriptions via the CODA configuration menu.
''',
'images' : ['images/coda_logs.jpeg','images/import_coda_logs.jpeg'],
- 'depends': ['account_voucher','base_iban', 'l10n_be_invoice_bba', 'account_bank_statement_extensions'],
+ 'depends': ['account_voucher','base_iban', 'l10n_be_invoice_bba',],
'demo': [],
'data': [
'l10n_be_coda_wizard.xml',
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 2286caf8f68..eac8f83e6da 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -262,25 +262,39 @@ class account_coda_import(osv.osv_memory):
line['counterpartyNumber'] = False
except:
pass
+ partner = None
partner_id = None
if 'counterpartyNumber' in line and line['counterpartyNumber']:
ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
if ids and len(ids) > 0:
- partner_id = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id.id
+ partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id
+ partner_id = partner.id
+ if partner:
+ if partner.customer:
+ line['type'] = 'customer'
else:
- partner_id = None
+ line['type'] = 'supplier'
+ if line['debit'] == '1':
+ line['account'] = partner.property_account_payable.id
+ else:
+ line['account'] = partner.property_account_receivable.id
+ else:
+ line['type'] = 'general'
+ if line['debit'] == '1':
+ line['account'] = statement['journal_id'].default_debit_account_id.id
+ else:
+ line['account'] = statement['journal_id'].default_credit_account_id.id
+
data = {
'name': line['communication'],
'note': "\n".join(note),
'date': line['entryDate'],
'amount': line['amount'],
- # 'type': '',
+ 'type': line['type'],
'partner_id': partner_id,
- 'account_id': 1, # TODO
+ 'account_id': line['account'],
'statement_id': statement['id'],
- # 'analytic_account_id': '',
- # 'move_ids': '',
'ref': line['ref'],
'sequence': line['sequence'],
}
From d8a949edffc9e3f973680b4bd95f49f7a1e114b1 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 12:27:02 +0100
Subject: [PATCH 12/32] [ADD]Structured communications
bzr revid: dle@openerp.com-20121206112702-ii47dx25r7amegrq
---
addons/l10n_be_coda/wizard/account_coda_import.py | 6 +++++-
1 file changed, 5 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 eac8f83e6da..fdabf9e8615 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -126,7 +126,11 @@ class account_coda_import(osv.osv_memory):
statementLine['transaction_family'] = rmspaces(line[54:56])
statementLine['transaction_code'] = rmspaces(line[56:58])
statementLine['transaction_category'] = rmspaces(line[58:61])
- statementLine['communication'] = rmspaces(line[62:115])
+ if line[61] == '1':
+ #Structured communication
+ statementLine['communication'] = '+++' + line[65:68] + '/' + line[68:72] + '/' + line[72:77] + '+++'
+ else:
+ statementLine['communication'] = rmspaces(line[62:115])
statementLine['entryDate'] = rmspaces(line[115:121])
statementLine['type'] = 'normal'
statementLine['globalisation'] = int(line[124])
From 0fc6e5480bef93c8729d39c04444c22fd1b6a3fa Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 16:12:07 +0100
Subject: [PATCH 13/32] [FIX]Name field displayed back in bank statement form
(instead of displaying notes), handling structured communication types,
defining account depending on partner found thanks to invoice or bank account
bzr revid: dle@openerp.com-20121206151207-o8zxzfoybmlv3u6b
---
addons/account/account_view.xml | 3 +-
.../wizard/account_coda_import.py | 140 +++++++++++++-----
2 files changed, 106 insertions(+), 37 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 7d18961a5a3..6d3519cc461 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -574,9 +574,8 @@
-
-
+
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index fdabf9e8615..d0ecefa6a9b 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -128,8 +128,12 @@ class account_coda_import(osv.osv_memory):
statementLine['transaction_category'] = rmspaces(line[58:61])
if line[61] == '1':
#Structured communication
+ statementLine['communication_struct'] = True
+ statementLine['communication_type'] = line[62:65]
statementLine['communication'] = '+++' + line[65:68] + '/' + line[68:72] + '/' + line[72:77] + '+++'
else:
+ #Non-structured communication
+ statementLine['communication_struct'] = False
statementLine['communication'] = rmspaces(line[62:115])
statementLine['entryDate'] = rmspaces(line[115:121])
statementLine['type'] = 'normal'
@@ -156,7 +160,8 @@ class account_coda_import(osv.osv_memory):
raise osv.except_osv(_('Error') + 'R2005', _('CODA parsing error on movement data record 2.3, seq nr %s! Please report this issue via your OpenERP support channel.') % line[2:10])
if statement['version'] == '1':
statement['lines'][-1]['counterpartyNumber'] = rmspaces(line[10:22])
- statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:125])
+ statement['lines'][-1]['counterpartyName'] = rmspaces(line[47:73])
+ statement['lines'][-1]['counterpartyAddress'] = rmspaces(line[73:125])
statement['lines'][-1]['counterpartyCurrency'] = ''
else:
if line[22] == ' ':
@@ -235,15 +240,76 @@ class account_coda_import(osv.osv_memory):
statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
for line in statement['lines']:
if line['type'] == 'normal':
+ note = []
counterparty = []
if 'counterpartyName' in line:
counterparty.append(line['counterpartyName'])
- if 'counterpartyNumber' in line:
+ try:
+ if 'counterpartyNumber' in line and int(line['counterpartyNumber']) == 0:
+ line['counterpartyNumber'] = False
+ except:
+ pass
+ if 'counterpartyNumber' in line and line['counterpartyNumber']:
counterparty.append(line['counterpartyNumber'])
if len(counterparty) > 0:
counterparty = '[' + ' / '.join(counterparty) + ']'
else:
counterparty = '/'
+ note.append(_('Counter Party') + ': ' + counterparty)
+
+ partner = None
+ partner_id = None
+ invoice = False
+ if line['communication_struct'] and 'communication_type' in line and line['communication_type'] == '101':
+ ids = self.pool.get('account.invoice').search(cr, uid, [('reference', '=', line['communication']), ('reference_type', '=', 'bba')])
+ if ids:
+ invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0])
+ partner = invoice.partner_id
+ partner_id = partner.id
+ if invoice.type in ['in_invoice', 'in_refund']:
+ line['type'] = 'supplier'
+ else:
+ line['type'] = 'customer'
+ if 'counterpartyNumber' in line and line['counterpartyNumber']:
+ ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
+ if ids and len(ids) > 0:
+ partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id
+ partner_id = partner.id
+ if not invoice:
+ if partner.customer and line['debit'] == '0':
+ line['type'] = 'customer'
+ elif partner.supplier and line['debit'] == '1':
+ line['type'] = 'supplier'
+ else:
+ line['type'] = 'general'
+ # if line['debit'] == '1':
+ # line['account'] = partner.property_account_payable.id
+ # else:
+ # line['account'] = partner.property_account_receivable.id
+ if partner:
+ if line['type'] == 'customer':
+ line['account'] = partner.property_account_receivable.id
+ elif line['type'] == 'supplier':
+ line['account'] = partner.property_account_payable.id
+ else:
+ if line['debit'] == '1':
+ line['account'] = partner.property_account_payable.id
+ else:
+ line['account'] = partner.property_account_receivable.id
+ note.append(_('Communication') + ': ' + line['communication'])
+ if not partner:
+ line['type'] = 'general'
+ if line['debit'] == '1':
+ line['account'] = statement['journal_id'].default_debit_account_id.id
+ else:
+ line['account'] = statement['journal_id'].default_credit_account_id.id
+ note.append(_('Communication') + ': ' + line['communication'])
+ if 'communication_type' in line:
+ if line['communication_type'] in communication_types:
+ line['communication_type'] = communication_types[line['communication_type']]
+ else:
+ line['communication_type'] = 'Unknown'
+ note.append(_('Communication Type') + ': ' + line['communication_type'])
if line['transaction_type'] in transaction_types:
line['transaction_type'] = transaction_types[line['transaction_type']][1]
if line['transaction_category'] in transaction_categories:
@@ -253,45 +319,13 @@ class account_coda_import(osv.osv_memory):
line['transaction_family'] = transaction_family[0]
if line['transaction_code'] in transaction_family[1]:
line['transaction_code'] = transaction_family[1][line['transaction_code']]
- note = []
- note.append(_('Counter Party') + ': ' + counterparty)
- note.append(_('Communication') + ': ' + line['communication'])
note.append(_('Transaction type') + ': ' + line['transaction_type'])
note.append(_('Transaction family') + ': ' + line['transaction_family'])
note.append(_('Transaction code') + ': ' + line['transaction_code'])
note.append(_('Transaction category') + ': ' + line['transaction_category'])
- try:
- if 'counterpartyNumber' in line and int(line['counterpartyNumber']) == 0:
- line['counterpartyNumber'] = False
- except:
- pass
- partner = None
- partner_id = None
- if 'counterpartyNumber' in line and line['counterpartyNumber']:
- ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
- if ids and len(ids) > 0:
- partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id
- partner_id = partner.id
- if partner:
- if partner.customer:
- line['type'] = 'customer'
- else:
- line['type'] = 'supplier'
- if line['debit'] == '1':
- line['account'] = partner.property_account_payable.id
- else:
- line['account'] = partner.property_account_receivable.id
- else:
- line['type'] = 'general'
- if line['debit'] == '1':
- line['account'] = statement['journal_id'].default_debit_account_id.id
- else:
- line['account'] = statement['journal_id'].default_credit_account_id.id
-
-
data = {
- 'name': line['communication'],
+ 'name': counterparty + '\n' + line['communication'],
'note': "\n".join(note),
'date': line['entryDate'],
'amount': line['amount'],
@@ -752,6 +786,42 @@ transaction_categories = {
"431": "Delivery of a copy",
}
+communication_types = {
+ "001": "Data concerning the counterparty",
+ "002": "Communication of the bank",
+ "003": "RBP data",
+ "004": "Counterparty’s banker",
+ "005": "Data concerning the correspondent",
+ "006": "Information concerning the detail amount",
+ "007": "Information concerning the detail cash",
+ "008": "Identification of the de ultimate beneficiary/creditor (SEPA SCT/SDD)",
+ "009": "Identification of the de ultimate ordering customer/debtor (SEPA SCT/SDD)",
+ "010": "Information pertaining to sale or purchase of securities",
+ "011": "Information pertaining to coupons",
+ "100": "(SEPA) payment with a structured format communication applying the ISO standard 11649: Structured creditor reference to remittan",
+ "101": "Credit transfer or cash payment with structured format communication",
+ "102": "Credit transfer or cash payment with reconstituted structured format communication",
+ "103": "number (e.g. of the cheque, of the card, etc.)",
+ "104": "Equivalent in EUR",
+ "105": "original amount of the transaction",
+ "106": "Method of calculation (VAT, withholding tax on income, commission, etc.)",
+ "107": "Direct debit – DOM’80",
+ "108": "Closing",
+ "111": "POS credit – Globalisation",
+ "112": "ATM payment (usually Eurocheque card)",
+ "113": "ATM/POS debit",
+ "114": "POS credit - individual transaction",
+ "115": "Terminal cash deposit",
+ "120": "Correction of a transaction",
+ "121": "Commercial bills",
+ "122": "Bills - calculation of interest",
+ "123": "Fees and commissions",
+ "124": "Number of the credit card",
+ "125": "Credit",
+ "126": "Term investments",
+ "127": "European direct debit (SEPA)",
+}
+
def rmspaces(s):
return " ".join(s.split())
From 512a5c5ed6eb135b6005b549e1c93500bb6c1b1d Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 16:12:54 +0100
Subject: [PATCH 14/32] [DEL]Useless comment
bzr revid: dle@openerp.com-20121206151254-qtedm28bxagp4shy
---
addons/l10n_be_coda/wizard/account_coda_import.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index d0ecefa6a9b..5e6df14ffb4 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -282,10 +282,6 @@ class account_coda_import(osv.osv_memory):
line['type'] = 'supplier'
else:
line['type'] = 'general'
- # if line['debit'] == '1':
- # line['account'] = partner.property_account_payable.id
- # else:
- # line['account'] = partner.property_account_receivable.id
if partner:
if line['type'] == 'customer':
line['account'] = partner.property_account_receivable.id
From 15b03bb0b684c4118adca60844ddcaaad3244e3b Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 16:55:24 +0100
Subject: [PATCH 15/32] [FIX]Name and note field not well structured
bzr revid: dle@openerp.com-20121206155524-hha9r6ab931b3cj9
---
.../wizard/account_coda_import.py | 33 ++++++++++---------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 5e6df14ffb4..aab468adcc9 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -241,21 +241,23 @@ class account_coda_import(osv.osv_memory):
for line in statement['lines']:
if line['type'] == 'normal':
note = []
- counterparty = []
- if 'counterpartyName' in line:
- counterparty.append(line['counterpartyName'])
- try:
- if 'counterpartyNumber' in line and int(line['counterpartyNumber']) == 0:
- line['counterpartyNumber'] = False
- except:
- pass
- if 'counterpartyNumber' in line and line['counterpartyNumber']:
- counterparty.append(line['counterpartyNumber'])
- if len(counterparty) > 0:
- counterparty = '[' + ' / '.join(counterparty) + ']'
+ if 'counterpartyName' in line and line['counterpartyName'] != '':
+ note.append(_('Counter Party') + ': ' + line['counterpartyName'])
else:
- counterparty = '/'
- note.append(_('Counter Party') + ': ' + counterparty)
+ line['counterpartyName'] = False
+ if 'counterpartyNumber' in line and line['counterpartyNumber'] != '':
+ try:
+ if int(line['counterpartyNumber']) == 0:
+ line['counterpartyNumber'] = False
+ except:
+ pass
+ if line['counterpartyNumber']:
+ note.append(_('Counter Party Account') + ': ' + line['counterpartyNumber'])
+ else:
+ line['counterpartyNumber'] = False
+
+ if 'counterpartyAddress' in line and line['counterpartyAddress'] != '':
+ note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress'])
partner = None
partner_id = None
@@ -292,7 +294,6 @@ class account_coda_import(osv.osv_memory):
line['account'] = partner.property_account_payable.id
else:
line['account'] = partner.property_account_receivable.id
- note.append(_('Communication') + ': ' + line['communication'])
if not partner:
line['type'] = 'general'
if line['debit'] == '1':
@@ -321,7 +322,7 @@ class account_coda_import(osv.osv_memory):
note.append(_('Transaction category') + ': ' + line['transaction_category'])
data = {
- 'name': counterparty + '\n' + line['communication'],
+ 'name': "\n".join(filter(None, [line['counterpartyName'], line['communication']])),
'note': "\n".join(note),
'date': line['entryDate'],
'amount': line['amount'],
From 8f9ff4d19acd91ec63cd6a478ebaa1b2f677d6c4 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 16:59:37 +0100
Subject: [PATCH 16/32] [FIX]Entry date not parsed by strftime :(
bzr revid: dle@openerp.com-20121206155937-8ngexk7iulkt04va
---
addons/l10n_be_coda/wizard/account_coda_import.py | 2 +-
1 file changed, 1 insertion(+), 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 aab468adcc9..81bd2458496 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -135,7 +135,7 @@ class account_coda_import(osv.osv_memory):
#Non-structured communication
statementLine['communication_struct'] = False
statementLine['communication'] = rmspaces(line[62:115])
- statementLine['entryDate'] = rmspaces(line[115:121])
+ statementLine['entryDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[115:121]), '%d%m%y'))
statementLine['type'] = 'normal'
statementLine['globalisation'] = int(line[124])
if len(statement['globalisation_stack']) > 0 and statementLine['communication'] != '':
From f876c1993068b4087e5d49a536da118db40f7e50 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 17:49:28 +0100
Subject: [PATCH 17/32] [ADD]Create voucher
bzr revid: dle@openerp.com-20121206164928-axdnk309y2o3zwrr
---
.../wizard/account_coda_import.py | 26 ++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 81bd2458496..f1fcc8fd760 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -258,6 +258,7 @@ class account_coda_import(osv.osv_memory):
if 'counterpartyAddress' in line and line['counterpartyAddress'] != '':
note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress'])
+ line['name'] = "\n".join(filter(None, [line['counterpartyName'], line['communication']]))
partner = None
partner_id = None
@@ -268,10 +269,29 @@ class account_coda_import(osv.osv_memory):
invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0])
partner = invoice.partner_id
partner_id = partner.id
- if invoice.type in ['in_invoice', 'in_refund']:
+ # voucher_vals = {
+ # 'type': line['type'] == 'supplier' and 'payment' or 'receipt',
+ # 'name': line_name,
+ # 'partner_id': line['partner_id'],
+ # 'journal_id': statement['journal_id'],
+ # 'account_id': journal.default_credit_account_id.id,
+ # 'company_id': journal.company_id.id,
+ # 'currency_id': journal.company_id.currency_id.id,
+ # 'date': line['entry_date'],
+ # 'amount': abs(line['amount']),
+ # 'period_id': statement['period_id'],
+ # }
+ context = {'line_type': line['type'], 'default_type': line['amount'] < 0 and 'payment' or 'receipt', 'type': line['amount'] < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': statement['journal_id'].id, 'default_amount': abs(line['amount']), 'default_reference': line['ref'], 'default_date': line['entryDate'], 'default_name': line['name'], 'default_active': False}
+ if invoice.type in ['in_invoice', 'in_refund'] and line['debit'] == '1':
line['type'] = 'supplier'
- else:
+ print 'Supplier'
+ print self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_payable.id}, context=context)
+ elif invoice.type in ['out_invoice'] and line['debit'] == '0':
line['type'] = 'customer'
+ print 'Customer'
+ print self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_receivable.id}, context=context)
+ else:
+ line['type'] = 'general'
if 'counterpartyNumber' in line and line['counterpartyNumber']:
ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
if ids and len(ids) > 0:
@@ -322,7 +342,7 @@ class account_coda_import(osv.osv_memory):
note.append(_('Transaction category') + ': ' + line['transaction_category'])
data = {
- 'name': "\n".join(filter(None, [line['counterpartyName'], line['communication']])),
+ 'name': line['name'],
'note': "\n".join(note),
'date': line['entryDate'],
'amount': line['amount'],
From 6cb854df33e7ec5f543c9c13a68065b4a9b288b5 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Thu, 6 Dec 2012 18:35:30 +0100
Subject: [PATCH 18/32] [ADD]Voucher creation
bzr revid: dle@openerp.com-20121206173530-s46asy6pomk6if4t
---
.../wizard/account_coda_import.py | 33 +++++++++----------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index f1fcc8fd760..6de8bdc8104 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -269,27 +269,22 @@ class account_coda_import(osv.osv_memory):
invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0])
partner = invoice.partner_id
partner_id = partner.id
- # voucher_vals = {
- # 'type': line['type'] == 'supplier' and 'payment' or 'receipt',
- # 'name': line_name,
- # 'partner_id': line['partner_id'],
- # 'journal_id': statement['journal_id'],
- # 'account_id': journal.default_credit_account_id.id,
- # 'company_id': journal.company_id.id,
- # 'currency_id': journal.company_id.currency_id.id,
- # 'date': line['entry_date'],
- # 'amount': abs(line['amount']),
- # 'period_id': statement['period_id'],
- # }
- context = {'line_type': line['type'], 'default_type': line['amount'] < 0 and 'payment' or 'receipt', 'type': line['amount'] < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': statement['journal_id'].id, 'default_amount': abs(line['amount']), 'default_reference': line['ref'], 'default_date': line['entryDate'], 'default_name': line['name'], 'default_active': False}
+ context = {
+ 'default_partner_id': partner_id,
+ 'default_amount': abs(line['amount']),
+ 'default_number': invoice.name,
+ 'close_after_process': True,
+ 'invoice_type': invoice.type,
+ 'invoice_id': invoice.id,
+ 'default_type': invoice.type in ['out_invoice', 'out_refund'] and 'receipt' or 'payment',
+ 'type': invoice.type in ['out_invoice', 'out_refund'] and 'receipt' or 'payment'
+ }
if invoice.type in ['in_invoice', 'in_refund'] and line['debit'] == '1':
line['type'] = 'supplier'
- print 'Supplier'
- print self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_payable.id}, context=context)
+ line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_payable.id, 'journal_id': statement['journal_id'].id}, context=context)
elif invoice.type in ['out_invoice'] and line['debit'] == '0':
line['type'] = 'customer'
- print 'Customer'
- print self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_receivable.id}, context=context)
+ line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_receivable.id, 'journal_id': statement['journal_id'].id}, context=context)
else:
line['type'] = 'general'
if 'counterpartyNumber' in line and line['counterpartyNumber']:
@@ -340,7 +335,8 @@ class account_coda_import(osv.osv_memory):
note.append(_('Transaction family') + ': ' + line['transaction_family'])
note.append(_('Transaction code') + ': ' + line['transaction_code'])
note.append(_('Transaction category') + ': ' + line['transaction_category'])
-
+ if 'voucher_id' not in line:
+ line['voucher_id'] = None
data = {
'name': line['name'],
'note': "\n".join(note),
@@ -352,6 +348,7 @@ class account_coda_import(osv.osv_memory):
'statement_id': statement['id'],
'ref': line['ref'],
'sequence': line['sequence'],
+ 'voucher_id': line['voucher_id'],
}
self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
From bee5426c7093e3292441a214882e0207b7f9d8b0 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Fri, 7 Dec 2012 13:58:38 +0100
Subject: [PATCH 19/32] [FIX]Voucher and voucher line
bzr revid: dle@openerp.com-20121207125838-n36yyge5d1vm65ir
---
.../wizard/account_coda_import.py | 49 ++++++++++++++-----
1 file changed, 36 insertions(+), 13 deletions(-)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 6de8bdc8104..97d99b89e83 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -269,24 +269,47 @@ class account_coda_import(osv.osv_memory):
invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0])
partner = invoice.partner_id
partner_id = partner.id
- context = {
- 'default_partner_id': partner_id,
- 'default_amount': abs(line['amount']),
- 'default_number': invoice.name,
- 'close_after_process': True,
- 'invoice_type': invoice.type,
- 'invoice_id': invoice.id,
- 'default_type': invoice.type in ['out_invoice', 'out_refund'] and 'receipt' or 'payment',
- 'type': invoice.type in ['out_invoice', 'out_refund'] and 'receipt' or 'payment'
- }
+
if invoice.type in ['in_invoice', 'in_refund'] and line['debit'] == '1':
line['type'] = 'supplier'
- line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_payable.id, 'journal_id': statement['journal_id'].id}, context=context)
- elif invoice.type in ['out_invoice'] and line['debit'] == '0':
+ elif invoice.type in ['out_invoice', 'out_refund'] and line['debit'] == '0':
line['type'] = 'customer'
- line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, {'account_id': partner.property_account_receivable.id, 'journal_id': statement['journal_id'].id}, context=context)
else:
line['type'] = 'general'
+ line['reconcile'] = False
+ if invoice.type in ['in_invoice', 'out_invoice']:
+ iml_ids = self.pool.get('account.move.line').search(cr, uid, [('move_id', '=', invoice.move_id.id), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)])
+ if iml_ids:
+ line['reconcile'] = iml_ids[0]
+ if line['reconcile']:
+ voucher_vals = {
+ 'type': line['type'] == 'supplier' and 'payment' or 'receipt',
+ 'name': line['name'],
+ 'partner_id': partner_id,
+ 'journal_id': statement['journal_id'].id,
+ 'account_id': statement['journal_id'].default_credit_account_id.id,
+ 'company_id': statement['journal_id'].company_id.id,
+ 'currency_id': statement['journal_id'].company_id.currency_id.id,
+ 'date': line['entryDate'],
+ 'amount': abs(line['amount']),
+ 'period_id': statement['period_id'],
+ 'invoice_id': invoice.id,
+ }
+ context['invoice_id'] = invoice.id
+ voucher_vals.update(self.pool.get('account.voucher').onchange_partner_id(cr, uid, [],
+ partner_id=partner_id,
+ journal_id=statement['journal_id'].id,
+ amount=abs(line['amount']),
+ currency_id=statement['journal_id'].company_id.currency_id.id,
+ ttype=line['type'] == 'supplier' and 'payment' or 'receipt',
+ date=line['transactionDate'],
+ context=context
+ )['value'])
+ line_drs = []
+ for line_dr in voucher_vals['line_dr_ids']:
+ line_drs.append((0, 0, line_dr))
+ voucher_vals['line_dr_ids'] = line_drs
+ line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, voucher_vals, context=context)
if 'counterpartyNumber' in line and line['counterpartyNumber']:
ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
if ids and len(ids) > 0:
From a0a3f862cca0c64dfd19053fb51c68b78ab17ede Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Fri, 7 Dec 2012 15:14:50 +0100
Subject: [PATCH 20/32] [ADD]CODA Notes and statement lines views
bzr revid: dle@openerp.com-20121207141450-i5kzwm1ojvkw42hy
---
addons/l10n_be_coda/__init__.py | 1 +
addons/l10n_be_coda/l10n_be_coda_view.xml | 93 ++++++++++++++++++-
.../wizard/account_coda_import.py | 26 ++++--
3 files changed, 110 insertions(+), 10 deletions(-)
diff --git a/addons/l10n_be_coda/__init__.py b/addons/l10n_be_coda/__init__.py
index c737eb79536..4a58b8ad059 100644
--- a/addons/l10n_be_coda/__init__.py
+++ b/addons/l10n_be_coda/__init__.py
@@ -20,6 +20,7 @@
#
##############################################################################
+import l10n_be_coda
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml
index 9a362cd6fc4..d4c896064a6 100644
--- a/addons/l10n_be_coda/l10n_be_coda_view.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_view.xml
@@ -1,6 +1,97 @@
-
+
+ account.bank.statement.form
+ account.bank.statement
+
+
+
+
+
+
+
+
+
+
+ bank.statement.line.coda.form
+ account.bank.statement.line
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.bank.statement.line.coda.tree
+ account.bank.statement.line
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bank.statement.line.coda.filter
+ account.bank.statement.line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bank Statement Lines
+ account.bank.statement.line
+ form
+ tree,form
+ {'block_statement_line_delete' : 1}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 97d99b89e83..9513d7accc2 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -188,8 +188,6 @@ class account_coda_import(osv.osv_memory):
infoLine['transaction_code'] = rmspaces(line[34:36])
infoLine['transaction_category'] = rmspaces(line[36:39])
infoLine['communication'] = rmspaces(line[40:113])
- infoLine['amount'] = 0.0
- infoLine['type'] = 'information'
statement['lines'].append(infoLine)
elif line[1] == '2':
if infoLine['ref'] != rmspaces(line[2:10]):
@@ -205,8 +203,6 @@ class account_coda_import(osv.osv_memory):
comm_line['sequence'] = len(statement['lines']) + 1
comm_line['ref'] = rmspaces(line[2:10])
comm_line['communication'] = rmspaces(line[32:112])
- comm_line['amount'] = 0.0
- comm_line['type'] = 'communication'
statement['lines'].append(comm_line)
elif line[0] == '8':
# new balance record
@@ -229,6 +225,7 @@ class account_coda_import(osv.osv_memory):
if not statement['balance_end_real']:
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
for i, statement in enumerate(statements):
+ statement['coda_note'] = ''
data = {
'name': '[' + statement['date'] + ']' + statement['description'],
'date': statement['date'],
@@ -239,7 +236,20 @@ class account_coda_import(osv.osv_memory):
}
statement['id'] = self.pool.get('account.bank.statement').create(cr, uid, data, context=context)
for line in statement['lines']:
- if line['type'] == 'normal':
+ if line['type'] == 'information':
+ if line['transaction_type'] in transaction_types:
+ line['transaction_type'] = transaction_types[line['transaction_type']][1]
+ if line['transaction_category'] in transaction_categories:
+ line['transaction_category'] = transaction_categories[line['transaction_category']]
+ if line['transaction_family'] in transaction_codes:
+ transaction_family = transaction_codes[line['transaction_family']]
+ line['transaction_family'] = transaction_family[0]
+ if line['transaction_code'] in transaction_family[1]:
+ line['transaction_code'] = transaction_family[1][line['transaction_code']]
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Date: ' + str(line['entryDate']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
+ elif line['type'] == 'communication':
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
+ elif line['type'] == 'normal':
note = []
if 'counterpartyName' in line and line['counterpartyName'] != '':
note.append(_('Counter Party') + ': ' + line['counterpartyName'])
@@ -259,7 +269,6 @@ class account_coda_import(osv.osv_memory):
if 'counterpartyAddress' in line and line['counterpartyAddress'] != '':
note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress'])
line['name'] = "\n".join(filter(None, [line['counterpartyName'], line['communication']]))
-
partner = None
partner_id = None
invoice = False
@@ -342,8 +351,6 @@ class account_coda_import(osv.osv_memory):
if 'communication_type' in line:
if line['communication_type'] in communication_types:
line['communication_type'] = communication_types[line['communication_type']]
- else:
- line['communication_type'] = 'Unknown'
note.append(_('Communication Type') + ': ' + line['communication_type'])
if line['transaction_type'] in transaction_types:
line['transaction_type'] = transaction_types[line['transaction_type']][1]
@@ -374,7 +381,8 @@ class account_coda_import(osv.osv_memory):
'voucher_id': line['voucher_id'],
}
self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
-
+ if statement['coda_note'] != '':
+ self.pool.get('account.bank.statement').write(cr, uid, [statement['id']], {'coda_note': statement['coda_note']}, context=context)
account_coda_import()
transaction_types = {
From 16bfe104aa6d1b49e685930b645b1017704d993e Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Fri, 7 Dec 2012 15:15:09 +0100
Subject: [PATCH 21/32] [ADD]coda py file
bzr revid: dle@openerp.com-20121207141509-7i8evz7i5dn00b11
---
addons/l10n_be_coda/l10n_be_coda.py | 34 +++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 addons/l10n_be_coda/l10n_be_coda.py
diff --git a/addons/l10n_be_coda/l10n_be_coda.py b/addons/l10n_be_coda/l10n_be_coda.py
new file mode 100644
index 00000000000..e22bec27aab
--- /dev/null
+++ b/addons/l10n_be_coda/l10n_be_coda.py
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+#
+# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import osv, fields
+
+
+class account_bank_statement(osv.osv):
+ _inherit = 'account.bank.statement'
+ _columns = {
+ 'coda_note': fields.text('CODA Notes'),
+ }
+
+account_bank_statement()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From 8825ea3ae64180c89c15651ad19e2c28af55c32c Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Fri, 7 Dec 2012 15:31:44 +0100
Subject: [PATCH 22/32] [FIX]coda note with int not str, import wizard returns
to banks statement tree
bzr revid: dle@openerp.com-20121207143144-13vfmr4o37e1rntb
---
addons/l10n_be_coda/l10n_be_coda_wizard.xml | 19 -------------------
.../wizard/account_coda_import.py | 18 +++++++++++++-----
2 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/addons/l10n_be_coda/l10n_be_coda_wizard.xml b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
index 427e0c1991e..92b16db0e88 100644
--- a/addons/l10n_be_coda/l10n_be_coda_wizard.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
@@ -21,25 +21,6 @@
-
- Import CODA File
- account.coda.import
- 2
-
-
-
-
-
- or
-
-
-
-
-
-
-
-
-
Import CODA Fileir.actions.act_window
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 9513d7accc2..1118f5a4ae6 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -89,10 +89,10 @@ class account_coda_import(osv.osv_memory):
raise osv.except_osv(_('Error') + 'R1002', _('Foreign bank accounts with IBAN structure are not supported '))
else: # Something else, not supported
raise osv.except_osv(_('Error') + 'R1003', _('Unsupported bank account structure '))
- ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])])
+ bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', statement['acc_number'])])
not_found_except = osv.except_osv(_('Error') + 'R1004', _("No matching CODA Bank Account Configuration record found. Please check if the 'Bank Account Number' and 'Currency' fields of your configuration record match with '%s' and '%s'.") % (statement['acc_number'], statement['currency']))
- if ids and len(ids) > 0:
- bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, ids)
+ if bank_ids and len(bank_ids) > 0:
+ bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids)
for bank_acc in bank_accs:
statement['journal_id'] = bank_acc.journal_id
if (statement['journal_id'].currency and statement['journal_id'].currency.name != statement['currency']) and (not statement['journal_id'].currency and statement['journal_id'].company_id.currency_id.name != statement['currency']):
@@ -246,9 +246,9 @@ class account_coda_import(osv.osv_memory):
line['transaction_family'] = transaction_family[0]
if line['transaction_code'] in transaction_family[1]:
line['transaction_code'] = transaction_family[1][line['transaction_code']]
- statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Date: ' + str(line['entryDate']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Date: ' + str(line['entryDate']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'], '\n'])
elif line['type'] == 'communication':
- statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'],'\n'])
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'], '\n'])
elif line['type'] == 'normal':
note = []
if 'counterpartyName' in line and line['counterpartyName'] != '':
@@ -383,6 +383,14 @@ class account_coda_import(osv.osv_memory):
self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context)
if statement['coda_note'] != '':
self.pool.get('account.bank.statement').write(cr, uid, [statement['id']], {'coda_note': statement['coda_note']}, context=context)
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'tree',
+ 'res_model': 'account.bank.statement',
+ 'view_id': False,
+ 'context': context,
+ 'type': 'ir.actions.act_window',
+ }
account_coda_import()
transaction_types = {
From fbcdfed860176b6c5af35c9a8d6843d8c938e633 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Fri, 7 Dec 2012 15:55:19 +0100
Subject: [PATCH 23/32] [FIX]Groups technical for CODA Notes and bank statement
lines, form added to view mode for views after import, coda note information
reference
bzr revid: dle@openerp.com-20121207145519-4vbb1otng09wj3kg
---
addons/l10n_be_coda/l10n_be_coda_view.xml | 4 ++--
addons/l10n_be_coda/l10n_be_coda_wizard.xml | 10 +++++-----
addons/l10n_be_coda/wizard/account_coda_import.py | 6 +++---
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml
index d4c896064a6..538332b37d2 100644
--- a/addons/l10n_be_coda/l10n_be_coda_view.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_view.xml
@@ -7,7 +7,7 @@
-
+
@@ -91,7 +91,7 @@
-
+
\ No newline at end of file
diff --git a/addons/l10n_be_coda/l10n_be_coda_wizard.xml b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
index 92b16db0e88..dddc18bb30a 100644
--- a/addons/l10n_be_coda/l10n_be_coda_wizard.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
@@ -8,15 +8,15 @@
1
-
-
- or
-
-
+
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 1118f5a4ae6..7d50e4ba0d3 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -246,9 +246,9 @@ class account_coda_import(osv.osv_memory):
line['transaction_family'] = transaction_family[0]
if line['transaction_code'] in transaction_family[1]:
line['transaction_code'] = transaction_family[1][line['transaction_code']]
- statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Date: ' + str(line['entryDate']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'], '\n'])
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' with Ref. ' + str(line['ref']), 'Date: ' + str(line['entryDate']), 'Communication: ' + line['communication'], ''])
elif line['type'] == 'communication':
- statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' #' + str(line['sequence']), 'Ref: ' + str(line['ref']), 'Communication: ' + line['communication'], '\n'])
+ statement['coda_note'] = "\n".join([statement['coda_note'], line['type'].title() + ' with Ref. ' + str(line['ref']), 'Ref: ', 'Communication: ' + line['communication'], ''])
elif line['type'] == 'normal':
note = []
if 'counterpartyName' in line and line['counterpartyName'] != '':
@@ -385,7 +385,7 @@ class account_coda_import(osv.osv_memory):
self.pool.get('account.bank.statement').write(cr, uid, [statement['id']], {'coda_note': statement['coda_note']}, context=context)
return {
'view_type': 'form',
- 'view_mode': 'tree',
+ 'view_mode': 'tree,form',
'res_model': 'account.bank.statement',
'view_id': False,
'context': context,
From 62bb893da70b757813fc20a49a64ed527394cddf Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Sat, 8 Dec 2012 12:08:02 +0100
Subject: [PATCH 24/32] [FIX]Mmissing adding magic number for credit lines in
voucher
bzr revid: dle@openerp.com-20121208110802-226tomv7ni26r0nh
---
addons/l10n_be_coda/wizard/account_coda_import.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 7d50e4ba0d3..d27b28c315c 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -318,6 +318,10 @@ class account_coda_import(osv.osv_memory):
for line_dr in voucher_vals['line_dr_ids']:
line_drs.append((0, 0, line_dr))
voucher_vals['line_dr_ids'] = line_drs
+ line_crs = []
+ for line_cr in voucher_vals['line_cr_ids']:
+ line_crs.append((0, 0, line_cr))
+ voucher_vals['line_cr_ids'] = line_crs
line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, voucher_vals, context=context)
if 'counterpartyNumber' in line and line['counterpartyNumber']:
ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))])
From 07527e1503b93926ab2cecc15d78d4705ac897a3 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Mon, 10 Dec 2012 13:22:47 +0100
Subject: [PATCH 25/32] [ADD]Check start balance option
bzr revid: dle@openerp.com-20121210122247-qb2sa1k183wrxh3d
---
addons/l10n_be_coda/l10n_be_coda_view.xml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml
index 538332b37d2..4cb863d234a 100644
--- a/addons/l10n_be_coda/l10n_be_coda_view.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_view.xml
@@ -2,7 +2,7 @@
- account.bank.statement.form
+ account.bank.statement.coda.formaccount.bank.statement
@@ -13,6 +13,18 @@
+
+ res.partner.bank.coda.form
+ res.partner.bank
+
+
+
+
+
+
+
+
+ bank.statement.line.coda.formaccount.bank.statement.line
From 54a39ac1b1ef5ebe7071afccdf3a25e097f70833 Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Mon, 10 Dec 2012 13:55:17 +0100
Subject: [PATCH 26/32] [ADD]Missing py
bzr revid: dle@openerp.com-20121210125517-z4ehmco5dkmdxhmf
---
addons/l10n_be_coda/l10n_be_coda.py | 42 +++++++++++++++++++
.../wizard/account_coda_import.py | 16 ++++++-
2 files changed, 56 insertions(+), 2 deletions(-)
create mode 100644 addons/l10n_be_coda/l10n_be_coda.py
diff --git a/addons/l10n_be_coda/l10n_be_coda.py b/addons/l10n_be_coda/l10n_be_coda.py
new file mode 100644
index 00000000000..13b67e76bfd
--- /dev/null
+++ b/addons/l10n_be_coda/l10n_be_coda.py
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+#
+# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import osv, fields
+
+
+class account_bank_statement(osv.osv):
+ _inherit = 'account.bank.statement'
+ _columns = {
+ 'coda_note': fields.text('CODA Notes'),
+ }
+
+
+class res_bank(osv.osv):
+ _inherit = 'res.partner.bank'
+ _columns = {
+ 'balance_start_enforce': fields.boolean('Prevent invalid Opening Balances',
+ help="Do not process Statements with an Opening Balance that doesn't match the previous Closing Balance."),
+ }
+
+account_bank_statement()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index d27b28c315c..671a0a93335 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -94,9 +94,12 @@ class account_coda_import(osv.osv_memory):
if bank_ids and len(bank_ids) > 0:
bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids)
for bank_acc in bank_accs:
- statement['journal_id'] = bank_acc.journal_id
- if (statement['journal_id'].currency and statement['journal_id'].currency.name != statement['currency']) and (not statement['journal_id'].currency and statement['journal_id'].company_id.currency_id.name != statement['currency']):
+ if (bank_acc.journal_id.currency and bank_acc.journal_id.currency.name != statement['currency']) and (not bank_acc.journal_id.currency and bank_acc.journal_id.company_id.currency_id.name != statement['currency']):
raise not_found_except
+ else:
+ statement['journal_id'] = bank_acc.journal_id
+ statement['bank_account'] = bank_acc
+ break
else:
raise not_found_except
statement['description'] = rmspaces(line[90:125])
@@ -225,6 +228,15 @@ class account_coda_import(osv.osv_memory):
if not statement['balance_end_real']:
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
for i, statement in enumerate(statements):
+ balance_start_check_date = (len(statement['lines']) > 0 and statement['lines'][0]['entryDate']) or statement['date']
+ cr.execute('SELECT balance_end_real \
+ FROM account_bank_statement \
+ WHERE journal_id = %s and date <= %s \
+ ORDER BY date DESC,id DESC LIMIT 1', (statement['journal_id'].id, balance_start_check_date))
+ print statement['bank_account'].balance_start_enforce
+ res = cr.fetchone()
+ balance_start_check = res and res[0]
+ print balance_start_check
statement['coda_note'] = ''
data = {
'name': '[' + statement['date'] + ']' + statement['description'],
From 257db6feffb77844274828246af7eb1fee415a0b Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Mon, 10 Dec 2012 14:33:34 +0100
Subject: [PATCH 27/32] [ADD]Balance check
bzr revid: dle@openerp.com-20121210133334-jxepuwxf9safyeur
---
addons/l10n_be_coda/l10n_be_coda.py | 6 +++---
addons/l10n_be_coda/wizard/account_coda_import.py | 15 ++++++++++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/addons/l10n_be_coda/l10n_be_coda.py b/addons/l10n_be_coda/l10n_be_coda.py
index 13b67e76bfd..0b8bbf1bc24 100644
--- a/addons/l10n_be_coda/l10n_be_coda.py
+++ b/addons/l10n_be_coda/l10n_be_coda.py
@@ -27,14 +27,14 @@ class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
_columns = {
'coda_note': fields.text('CODA Notes'),
- }
+ }
class res_bank(osv.osv):
_inherit = 'res.partner.bank'
_columns = {
- 'balance_start_enforce': fields.boolean('Prevent invalid Opening Balances',
- help="Do not process Statements with an Opening Balance that doesn't match the previous Closing Balance."),
+ 'balance_start_enforce': fields.boolean('Prevent invalid Opening Balances',
+ help="Do not process Statements with an Opening Balance that doesn't match the previous Closing Balance."),
}
account_bank_statement()
diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py
index 671a0a93335..45b09e1a42f 100644
--- a/addons/l10n_be_coda/wizard/account_coda_import.py
+++ b/addons/l10n_be_coda/wizard/account_coda_import.py
@@ -228,16 +228,25 @@ class account_coda_import(osv.osv_memory):
if not statement['balance_end_real']:
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
for i, statement in enumerate(statements):
+ statement['coda_note'] = ''
balance_start_check_date = (len(statement['lines']) > 0 and statement['lines'][0]['entryDate']) or statement['date']
cr.execute('SELECT balance_end_real \
FROM account_bank_statement \
WHERE journal_id = %s and date <= %s \
ORDER BY date DESC,id DESC LIMIT 1', (statement['journal_id'].id, balance_start_check_date))
- print statement['bank_account'].balance_start_enforce
res = cr.fetchone()
balance_start_check = res and res[0]
- print balance_start_check
- statement['coda_note'] = ''
+ if balance_start_check == None:
+ if statement['journal_id'].default_debit_account_id and (statement['journal_id'].default_credit_account_id == statement['journal_id'].default_debit_account_id):
+ balance_start_check = statement['journal_id'].default_debit_account_id.balance
+ else:
+ raise osv.except_osv(_('Error'), _("Configuration Error in journal %s!\nPlease verify the Default Debit and Credit Account settings.") % statement['journal_id'].name)
+ if balance_start_check != statement['balance_start']:
+ balance_start_enforce_err = _("The CODA Statement %s Starting Balance (%.2f) does not correspond with the previous Closing Balance (%.2f) in journal %s!") % (statement['description'] + ' #' + statement['paperSeqNumber'], statement['balance_start'], balance_start_check, statement['journal_id'].name)
+ if statement['bank_account'].balance_start_enforce:
+ raise osv.except_osv(_('Error'), balance_start_enforce_err)
+ else:
+ statement['coda_note'] = balance_start_enforce_err
data = {
'name': '[' + statement['date'] + ']' + statement['description'],
'date': statement['date'],
From 73ba51f7af51c713b462b8bc766a0e7b6eef14ad Mon Sep 17 00:00:00 2001
From: "dle@openerp.com" <>
Date: Mon, 10 Dec 2012 15:06:20 +0100
Subject: [PATCH 28/32] [DEL]Transaction families, code, types, categories,
communication types, check balance end option
bzr revid: dle@openerp.com-20121210140620-upq370zuvsetoojw
---
addons/l10n_be_coda/l10n_be_coda.py | 8 -
addons/l10n_be_coda/l10n_be_coda_view.xml | 12 -
addons/l10n_be_coda/l10n_be_coda_wizard.xml | 1 -
.../wizard/account_coda_import.py | 526 +-----------------
4 files changed, 6 insertions(+), 541 deletions(-)
diff --git a/addons/l10n_be_coda/l10n_be_coda.py b/addons/l10n_be_coda/l10n_be_coda.py
index 0b8bbf1bc24..40792dd3d24 100644
--- a/addons/l10n_be_coda/l10n_be_coda.py
+++ b/addons/l10n_be_coda/l10n_be_coda.py
@@ -29,14 +29,6 @@ class account_bank_statement(osv.osv):
'coda_note': fields.text('CODA Notes'),
}
-
-class res_bank(osv.osv):
- _inherit = 'res.partner.bank'
- _columns = {
- 'balance_start_enforce': fields.boolean('Prevent invalid Opening Balances',
- help="Do not process Statements with an Opening Balance that doesn't match the previous Closing Balance."),
- }
-
account_bank_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml
index 4cb863d234a..2464e5e9082 100644
--- a/addons/l10n_be_coda/l10n_be_coda_view.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_view.xml
@@ -13,18 +13,6 @@
-
- res.partner.bank.coda.form
- res.partner.bank
-
-
-
-
-
-
-
-
- bank.statement.line.coda.formaccount.bank.statement.line
diff --git a/addons/l10n_be_coda/l10n_be_coda_wizard.xml b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
index dddc18bb30a..6e53a4d2ff0 100644
--- a/addons/l10n_be_coda/l10n_be_coda_wizard.xml
+++ b/addons/l10n_be_coda/l10n_be_coda_wizard.xml
@@ -10,7 +10,6 @@