From cb17def7be5b662026468b99a02e257b3a899722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 29 Oct 2015 18:28:04 +0100 Subject: [PATCH] [IMP] mis_builder: _get_additional_query_filter on period model This is more consistent in case we want to have an analytic filter on the columns. --- mis_builder/models/mis_builder.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mis_builder/models/mis_builder.py b/mis_builder/models/mis_builder.py index c2170618..7e4a7964 100644 --- a/mis_builder/models/mis_builder.py +++ b/mis_builder/models/mis_builder.py @@ -260,20 +260,6 @@ class MisReportQuery(models.Model): def _check_name(self): return _is_valid_python_var(self.name) - @api.multi - def _get_additional_filter(self): - """ Prepare an additional filter to apply on the query - - This filter is combined to the query domain with a AND - operator. This hook is intended - to be inherited, and is useful to implement filtering - on analytic dimensions or operational units. - - Returns an Odoo domain expression (a python list) - compatible with the model of the query.""" - self.ensure_one() - return [] - class MisReport(models.Model): """ A MIS report template (without period information) @@ -426,6 +412,20 @@ class MisReportInstancePeriod(models.Model): self.ensure_one() return [] + @api.multi + def _get_additional_query_filter(self, query): + """ Prepare an additional filter to apply on the query + + This filter is combined to the query domain with a AND + operator. This hook is intended + to be inherited, and is useful to implement filtering + on analytic dimensions or operational units. + + Returns an Odoo domain expression (a python list) + compatible with the model of the query.""" + self.ensure_one() + return [] + @api.multi def drilldown(self, expr): assert len(self) == 1 @@ -468,7 +468,7 @@ class MisReportInstancePeriod(models.Model): } domain = query.domain and \ safe_eval(query.domain, eval_context) or [] - domain.extend(query._get_additional_filter()) + domain.extend(self._get_additional_query_filter(query)) if query.date_field.ttype == 'date': domain.extend([(query.date_field.name, '>=', self.date_from), (query.date_field.name, '<=', self.date_to)])