From 67103b62652abf3baef637495b1f42780cae0b44 Mon Sep 17 00:00:00 2001 From: Thomas Winteler Date: Fri, 11 Jun 2021 07:50:40 +0200 Subject: [PATCH] [FIX] Update from old repo --- mis_builder/models/mis_report.py | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py index 8869cf7..021f5c2 100644 --- a/mis_builder/models/mis_report.py +++ b/mis_builder/models/mis_report.py @@ -612,24 +612,25 @@ class MisReport(models.Model): domain = query.domain and safe_eval(query.domain, eval_context) or [] if get_additional_query_filter: domain.extend(get_additional_query_filter(query)) - if query.date_field.ttype == "date": - domain.extend( - [ - (query.date_field.name, ">=", date_from), - (query.date_field.name, "<=", date_to), - ] - ) - else: - datetime_from = _utc_midnight(date_from, self._context.get("tz", "UTC")) - datetime_to = _utc_midnight( - date_to, self._context.get("tz", "UTC"), add_day=1 - ) - domain.extend( - [ - (query.date_field.name, ">=", datetime_from), - (query.date_field.name, "<", datetime_to), - ] - ) + if query.date_field.ttype: + if query.date_field.ttype == "date": + domain.extend( + [ + (query.date_field.name, ">=", date_from), + (query.date_field.name, "<=", date_to), + ] + ) + else: + datetime_from = _utc_midnight(date_from, self._context.get("tz", "UTC")) + datetime_to = _utc_midnight( + date_to, self._context.get("tz", "UTC"), add_day=1 + ) + domain.extend( + [ + (query.date_field.name, ">=", datetime_from), + (query.date_field.name, "<", datetime_to), + ] + ) field_names = [f.name for f in query.field_ids] all_stored = all([model._fields[f].store for f in field_names]) if not query.aggregate: