From 494187e0b58d077e5ff54cd191dd8a002b3bf715 Mon Sep 17 00:00:00 2001
From: "Jay (Open ERP)" <jvo@tinyerp.com>
Date: Tue, 10 Feb 2009 16:02:34 +0530
Subject: [PATCH] [FIX]If any account template has no code,no problem

bzr revid: jvo@tinyerp.com-20090210103234-z2v07jbj053xnln1
---
 addons/account/account.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/addons/account/account.py b/addons/account/account.py
index 328cdbe0bb41..0e5a1e425b63 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -2186,10 +2186,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
             #create the account_account for this bank journal
             tmp = self.pool.get('res.partner.bank').name_get(cr, uid, [line.acc_no.id])[0][1]
             dig = obj_multi.code_digits
+            new_code = str(current_num)
+            if ref_acc_bank.code:
+                new_code = str(ref_acc_bank.code.ljust(dig,'0') + str(current_num))
             vals = {
                 'name': line.acc_no.bank and line.acc_no.bank.name+' '+tmp or tmp,
                 'currency_id': line.currency_id and line.currency_id.id or False,
-                'code': str(ref_acc_bank.code.ljust(dig,'0') + str(current_num)),
+                'code': new_code,
                 'type': 'other',
                 'user_type': account_template.user_type and account_template.user_type.id or False,
                 'reconcile': True,
-- 
GitLab