From 5c4e7d7a2eef9c4bb6d0df6b3a4019332392d4d7 Mon Sep 17 00:00:00 2001 From: Zina Rasoamanana Date: Thu, 22 Aug 2024 10:12:58 +0200 Subject: [PATCH 1/2] [16.0][ADD] mis_builder: add option on report instance to drilldown in pop --- mis_builder/models/mis_report_instance.py | 5 ++++- mis_builder/views/mis_report_instance.xml | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index d5b096242..5a6734b7b 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -580,6 +580,9 @@ def _compute_pivot_date(self): string="Filter box search view", help="Search view to customize the filter box in the report widget.", ) + drilldown_open_in_pop_up = fields.Boolean( + string="Drilldown in a pop up window", + ) @api.depends("report_id.move_lines_source") def _compute_widget_search_view_id(self): @@ -921,7 +924,7 @@ def drilldown(self, arg): "res_model": period.source_aml_model_name, "views": [[False, view] for view in views], "view_mode": ",".join(view for view in views), - "target": "current", + "target": "new" if self.drilldown_open_in_pop_up else "current", "context": {"active_test": False}, } else: diff --git a/mis_builder/views/mis_report_instance.xml b/mis_builder/views/mis_report_instance.xml index f13fce50e..a38547542 100644 --- a/mis_builder/views/mis_report_instance.xml +++ b/mis_builder/views/mis_report_instance.xml @@ -208,6 +208,11 @@ + + + + + From 89f96ed2610da179cff910e88e033f99f0477985 Mon Sep 17 00:00:00 2001 From: Lindsay Date: Thu, 12 Sep 2024 12:45:23 +0200 Subject: [PATCH 2/2] [ADD] Use the complete context to use it from the outside if needed --- mis_builder/models/mis_report_instance.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 5a6734b7b..61caade8c 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -917,6 +917,10 @@ def drilldown(self, arg): ) domain.extend(period._get_additional_move_line_filter()) views = self._get_drilldown_model_views(period.source_aml_model_name) + # Keep all context for hook + context = dict(self.env.context) + context.update({"active_test": False}) + return { "name": self._get_drilldown_action_name(arg), "domain": domain, @@ -925,7 +929,7 @@ def drilldown(self, arg): "views": [[False, view] for view in views], "view_mode": ",".join(view for view in views), "target": "new" if self.drilldown_open_in_pop_up else "current", - "context": {"active_test": False}, + "context": context, } else: return False