Browse Source

Merge pull request #131 from acsone/8.0-analytic-filter-better-api-sbi

[IMP] mis_builder: _get_additional_query_filter on period model
pull/141/merge
Pedro M. Baeza 9 years ago
parent
commit
c9c941dc29
  1. 30
      mis_builder/models/mis_builder.py

30
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)])

Loading…
Cancel
Save