summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/graph/graph_controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/views/graph/graph_controller.js')
-rw-r--r--addons/web/static/src/js/views/graph/graph_controller.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_controller.js b/addons/web/static/src/js/views/graph/graph_controller.js
index 388d390701c..d68808bac1d 100644
--- a/addons/web/static/src/js/views/graph/graph_controller.js
+++ b/addons/web/static/src/js/views/graph/graph_controller.js
@@ -40,6 +40,22 @@ var GraphController = AbstractController.extend({
//--------------------------------------------------------------------------
/**
+ * Returns the current mode, measure and groupbys, so we can restore the
+ * view when we save the current state in the search view, or when we add it
+ * to the dashboard.
+ *
+ * @override
+ * @returns {Object}
+ */
+ getContext: function () {
+ var state = this.model.get();
+ return {
+ graph_measure: state.measure,
+ graph_mode: state.mode,
+ graph_groupbys: state.groupedBy,
+ };
+ },
+ /**
* Render the buttons according to the GraphView.buttons and
* add listeners on it.
* Set this.$buttons with the produced jQuery element