From 75f321a1ba2154e3169e79515142ebf782bf86e2 Mon Sep 17 00:00:00 2001
From: Martin Geubelle <mge@odoo.com>
Date: Wed, 7 Sep 2016 11:33:03 +0200
Subject: [PATCH] [ADD] web: get active view from action

---
 addons/web/static/src/js/action_manager.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js
index 0206e4cd25ef..b6a33e443d1d 100644
--- a/addons/web/static/src/js/action_manager.js
+++ b/addons/web/static/src/js/action_manager.js
@@ -93,6 +93,12 @@ var Action = core.Class.extend({
     get_fragment: function() {
         return this.$fragment;
     },
+    /**
+     * @return {string} the active view, i.e. empty for client actions
+     */
+    get_active_view: function() {
+        return '';
+    },
 });
 /**
  * Specialization of Action for client actions that are Widgets
@@ -196,6 +202,12 @@ var ViewManagerAction = WidgetAction.extend({
     get_nb_views: function() {
         return this.widget.view_stack.length;
     },
+    /**
+     * @return {string} the active view of the ViewManager
+     */
+    get_active_view: function() {
+        return this.widget.active_view.type;
+    }
 });
 
 var ActionManager = Widget.extend({
-- 
GitLab