openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #04545
[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara into lp:openobject-addons
Ashvin Rathod (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #684119 in OpenERP Addons: "[6.RC2] Account chart wizard does not check if generated account code for bank journal exsits"
https://bugs.launchpad.net/openobject-addons/+bug/684119
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-684119-ara/+merge/54660
Hello,
FIX: #684119 Account chart wizard does not check if generated account code for bank journal exsits
Thanks,
ara
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-684119-ara/+merge/54660
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara.
=== modified file 'account/account.py'
--- account/account.py 2011-03-17 17:33:16 +0000
+++ account/account.py 2011-03-24 08:50:52 +0000
@@ -2921,15 +2921,27 @@
ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
current_num = 1
+ valid = True
for line in obj_multi.bank_accounts_id:
#create the account_account for this bank journal
tmp = line.acc_name
dig = obj_multi.code_digits
if ref_acc_bank.code:
- try:
- new_code = str(int(ref_acc_bank.code.ljust(dig,'0')) + current_num)
- except:
- new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)),'0')) + str(current_num)
+ while valid:
+ try:
+ new_code = str(int(ref_acc_bank.code.ljust(dig, '0')) + current_num)
+ ids = obj_acc.search(cr, uid, [('code', '=', new_code)])
+ if not ids:
+ valid = False
+ else:
+ current_num += 1
+ except:
+ new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num)
+ ids = obj_acc.search(cr, uid, [('code', '=', new_code)])
+ if not ids:
+ valid = False
+ else:
+ current_num += 1
vals = {
'name': tmp,
'currency_id': line.currency_id and line.currency_id.id or False,
@@ -2962,6 +2974,7 @@
vals_journal['default_debit_account_id'] = acc_cash_id
obj_journal.create(cr, uid, vals_journal)
current_num += 1
+ valid = True
#create the properties
property_obj = self.pool.get('ir.property')
Follow ups