From ac208c3d46b8b1688398bc7a4cd06c86f6de6755 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 14 Mar 2019 15:35:08 +0100 Subject: [PATCH] [IMP] - set date_invoice as default group by for forecast pivot view --- contract_forecast/models/contract.py | 5 ++++- contract_forecast/views/contract_line_forecast_period.xml | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/contract_forecast/models/contract.py b/contract_forecast/models/contract.py index a4ab408d..9a1f6344 100644 --- a/contract_forecast/models/contract.py +++ b/contract_forecast/models/contract.py @@ -11,11 +11,14 @@ class AccountAnalyticAccount(models.Model): @api.multi def action_show_contract_forecast(self): self.ensure_one() + context = {'search_default_groupby_date_invoice': True} + context.update(self.env.context) + return { "type": "ir.actions.act_window", "name": _("Contract Forecast"), "res_model": "contract.line.forecast.period", "domain": [("contract_id", "=", self.id)], "view_mode": "pivot,tree", - "context": self.env.context, + "context": context, } diff --git a/contract_forecast/views/contract_line_forecast_period.xml b/contract_forecast/views/contract_line_forecast_period.xml index 8fe5d85a..381cc47c 100644 --- a/contract_forecast/views/contract_line_forecast_period.xml +++ b/contract_forecast/views/contract_line_forecast_period.xml @@ -19,7 +19,7 @@ + context="{'group_by':'date_invoice:day'}"/> @@ -48,8 +48,8 @@ contract.line.forecast.period - - + +