From b09a487c971876db4461491808a6de9f4ff0f236 Mon Sep 17 00:00:00 2001 From: Henrik Norlin Date: Sun, 21 Apr 2024 16:18:19 +0200 Subject: [PATCH] [IMP] mis_builder_budget: drilldown with default budget & account --- mis_builder/models/mis_report_instance.py | 4 +++- mis_builder_budget/models/mis_report_instance.py | 5 +++++ mis_builder_budget/readme/newsfragments/605.feature | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 mis_builder_budget/readme/newsfragments/605.feature diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 91fa3480e..7f95a06e4 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -944,6 +944,8 @@ def drilldown(self, arg): account_id, ) domain.extend(period._get_additional_move_line_filter()) + context = arg.get("context") or {} + context["active_test"] = False return { "name": self._get_drilldown_action_name(arg), "domain": domain, @@ -952,7 +954,7 @@ def drilldown(self, arg): "views": [[False, "list"], [False, "form"]], "view_mode": "list", "target": "current", - "context": {"active_test": False}, + "context": context, } else: return False diff --git a/mis_builder_budget/models/mis_report_instance.py b/mis_builder_budget/models/mis_report_instance.py index da3207ec9..f445909d2 100644 --- a/mis_builder_budget/models/mis_report_instance.py +++ b/mis_builder_budget/models/mis_report_instance.py @@ -118,4 +118,9 @@ def drilldown(self, arg): "view_mode": "list", "target": "current", } + elif period.source == SRC_MIS_BUDGET_BY_ACCOUNT: + arg["context"] = { + "default_budget_id": period.source_mis_budget_by_account_id.id, + "default_account_id": arg.get("account_id"), + } return super().drilldown(arg) diff --git a/mis_builder_budget/readme/newsfragments/605.feature b/mis_builder_budget/readme/newsfragments/605.feature new file mode 100644 index 000000000..cba13b16a --- /dev/null +++ b/mis_builder_budget/readme/newsfragments/605.feature @@ -0,0 +1,3 @@ +Drilldown to "Budget By Account Items": Pass default budget and default account. + +If the budget allows items overlap, one can create new budget items in the drilldown.