Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-923884-mdi into 
lp:openobject-addons.

Requested reviews:
  Divyesh Makwana(OpenERP) (mdi-openerp)
  Raphael Collet (OpenERP) (rco-openerp)
  qdp (OpenERP) (qdp)
  Purnendu Singh (OpenERP) (psi-tinyerp)
Related bugs:
  Bug #923884 in OpenERP Addons: "COA Creation wizard hangs up"
  https://bugs.launchpad.net/openobject-addons/+bug/923884

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-923884-mdi/+merge/91217

Hello Sir,

I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/923884 
"COA Creation wizard hangs up".

Thanks and Regards,

Divyesh Makwana(MDI)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-923884-mdi/+merge/91217
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-923884-mdi.
=== modified file 'account/account.py'
--- account/account.py	2012-02-02 10:03:05 +0000
+++ account/account.py	2012-02-03 06:08:20 +0000
@@ -3357,12 +3357,15 @@
         # its possible that we already have bank journals created (e.g. by the creation of res.partner.bank) 
         # and the next number for account code might have been already used before for journal
         journal_count = 0
-        while True:
-            journal_code = _('BNK') + str(current_num + journal_count)
+        for num in xrange(current_num, 100):
+            # journal_code has a maximal size of 5, hence we can enforce the boundary num < 100
+            journal_code = _('BNK')[:3] + str(current_num + journal_count)
             ids = obj_journal.search(cr, uid, [('code', '=', journal_code), ('company_id', '=', company_id)], context=context)
             if not ids:
                 break
             journal_count += 1
+        else:
+            raise osv.except_osv(_('Error'), _('Cannot generate an unused journal code.'))
 
         vals = {
                 'name': line['acc_name'],

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to