From 9bacbe02a5a997c4c888d00e29aafd33fb84a409 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Sun, 9 Sep 2012 11:11:26 -0400 Subject: [PATCH] [FIX] 'NoneType' object has no attribute '__getitem__' --- mgmtsystem_kpi/mgmtsystem_kpi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mgmtsystem_kpi/mgmtsystem_kpi.py b/mgmtsystem_kpi/mgmtsystem_kpi.py index 2670a15c1..d24759dd0 100644 --- a/mgmtsystem_kpi/mgmtsystem_kpi.py +++ b/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)