Browse Source

[FIX] 'NoneType' object has no attribute '__getitem__'

pull/510/head^2
Maxime Chambreuil 12 years ago
parent
commit
9bacbe02a5
  1. 5
      mgmtsystem_kpi/mgmtsystem_kpi.py

5
mgmtsystem_kpi/mgmtsystem_kpi.py

@ -286,8 +286,9 @@ class mgmtsystem_kpi(osv.osv):
kpi_value = 0
if obj.kpi_type == 'local' and is_select_query(obj.kpi_code):
cr.execute(obj.kpi_code)
if is_one_value(cr.dictfetchall()):
kpi_value = cr.dictfetchone()['value']
dic = cr.dictfetchall()
if is_one_value(dic):
kpi_value = dic[0]['value']
elif obj.kpi_type == 'external' and obj.dbsource_id.id and is_select_query(obj.kpi_code):
dbsrc_obj = self.pool.get('base.external.dbsource').browse(cr, uid, obj.dbsource_id.id, context)
res = dbsrc_obj.execute(obj.kpi_code)

Loading…
Cancel
Save