|
|
@ -622,7 +622,10 @@ class mis_report_instance_period(orm.Model): |
|
|
|
localdict.update(self._fetch_queries(cr, uid, c, |
|
|
|
context=context)) |
|
|
|
|
|
|
|
for kpi in c.report_instance_id.report_id.kpi_ids: |
|
|
|
compute_queue = c.report_instance_id.report_id.kpi_ids |
|
|
|
recompute_queue = [] |
|
|
|
while True: |
|
|
|
for kpi in compute_queue: |
|
|
|
try: |
|
|
|
kpi_val_comment = kpi.expression |
|
|
|
kpi_eval_expression = aep.replace_expr(kpi.expression) |
|
|
@ -631,6 +634,11 @@ class mis_report_instance_period(orm.Model): |
|
|
|
kpi_val = None |
|
|
|
kpi_val_rendered = '#DIV/0' |
|
|
|
kpi_val_comment += '\n\n%s' % (traceback.format_exc(),) |
|
|
|
except ValueError: |
|
|
|
recompute_queue.append(kpi) |
|
|
|
kpi_val = None |
|
|
|
kpi_val_rendered = '#ERR' |
|
|
|
kpi_val_comment += '\n\n%s' % (traceback.format_exc(),) |
|
|
|
except: |
|
|
|
kpi_val = None |
|
|
|
kpi_val_rendered = '#ERR' |
|
|
@ -660,6 +668,18 @@ class mis_report_instance_period(orm.Model): |
|
|
|
'period_name': c.name, |
|
|
|
} |
|
|
|
|
|
|
|
if len(recompute_queue) == 0: |
|
|
|
# nothing to recompute, we are done |
|
|
|
break |
|
|
|
if len(recompute_queue) == len(compute_queue): |
|
|
|
# could not compute anything in this iteration |
|
|
|
# (ie real Value errors or cyclic dependency) |
|
|
|
# so we stop trying |
|
|
|
break |
|
|
|
# try again |
|
|
|
compute_queue = recompute_queue |
|
|
|
recompute_queue = [] |
|
|
|
|
|
|
|
return res |
|
|
|
|
|
|
|
|
|
|
|