[IMP] in order to set default chart which was last created set max of ids.
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Tue, 3 Sep 2013 05:37:15 +0000 (11:07 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Tue, 3 Sep 2013 05:37:15 +0000 (11:07 +0530)
bzr revid: tpa@tinyerp.com-20130903053715-zyduv0q0b81lz0vq

addons/account/account.py

index 1a593e4..9f9ee18 100644 (file)
@@ -3072,7 +3072,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
         ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
         if ids:
             if 'chart_template_id' in fields:
-                chart_id = ids[0]
+                #in order to get set default chart which was last created set max of ids.
+                chart_id = max(ids)
                 if context.get("default_charts"):
                     chart_id = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)[0]['res_id']
                 res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': chart_id})