[IMP] web_dashboard_tile: reduce computation time

pull/283/merge
Sylvain LE GAL 2018-01-31 15:09:35 +01:00
parent 214863ae79
commit 3fc62acb80
1 changed files with 4 additions and 1 deletions

View File

@ -173,7 +173,10 @@ class TileTile(models.Model):
elif self[f_function]: elif self[f_function]:
func = FIELD_FUNCTIONS[self[f_function]]['func'] func = FIELD_FUNCTIONS[self[f_function]]['func']
if func and self[f_field_id] and count: if func and self[f_field_id] and count:
vals = [x[self[f_field_id].name] for x in records] field_name = self[f_field_id].name
read_vals = records.search_read(
[('id', 'in', records.ids)], [field_name])
vals = [x[field_name] for x in read_vals]
value = func(vals) value = func(vals)
if self[f_function]: if self[f_function]:
try: try: