From 66bcf35260fea202209c430f67c48dadd39188c0 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 31 Jan 2018 15:09:35 +0100 Subject: [PATCH] [IMP] web_dashboard_tile: reduce computation time --- web_dashboard_tile/models/tile_tile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web_dashboard_tile/models/tile_tile.py b/web_dashboard_tile/models/tile_tile.py index e9e99280..8c4d18c1 100644 --- a/web_dashboard_tile/models/tile_tile.py +++ b/web_dashboard_tile/models/tile_tile.py @@ -174,7 +174,10 @@ class TileTile(models.Model): elif self[f_function]: func = FIELD_FUNCTIONS[self[f_function]]['func'] 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) if self[f_function]: try: