[FIX] web: display view name in debug menu ('Edit View: X')

Revision on https://github.com/odoo/odoo/commit/f7fbe8adffb1ee585c8171f6c86d38145c11848d

The commit above wrongly assumes that the object 'view' is an instance
of the view class. As a result, the property `display_name` was undefined.

This commit fixes the issue by letting the controller remember the name
of the view in a similar was as the type of the view. That way, the name
of the view can simply be retrieved from the instance of the controller
class.

Task-ID 1878254
This commit is contained in:
Alexandre Kühn
2018-09-03 17:04:45 +02:00
parent 6da3dafe94
commit 017e71322b
4 changed files with 6 additions and 2 deletions
@@ -43,6 +43,8 @@ var AbstractController = AbstractAction.extend(ControlPanelMixin, {
* @param {any} params.initialState the initialState
* @param {boolean} params.isMultiRecord
* @param {Object[]} params.actionViews
* @param {string|Object} params.viewName name of the view (e.g "List").
* This is an object with `core._lt`.
* @param {string} params.viewType
* @param {boolean} params.withControlPanel set to false to hide the
* ControlPanel
@@ -69,6 +71,7 @@ var AbstractController = AbstractAction.extend(ControlPanelMixin, {
this.groupable = params.groupable;
this.enableTimeRangeMenu = params.enableTimeRangeMenu;
this.actionViews = params.actionViews;
this.viewName = params.viewName;
this.viewType = params.viewType;
this.withControlPanel = params.withControlPanel !== false;
// override this.need_control_panel so that the ActionManager doesn't
@@ -153,6 +153,7 @@ var AbstractView = Class.extend({
this.controllerParams.searchView = params.action && params.action.searchView;
this.controllerParams.searchViewHidden = this.searchview_hidden; // AAB: use searchable instead where it is used?
this.controllerParams.actionViews = params.action ? params.action.views : [];
this.controllerParams.viewName = this.viewName;
this.controllerParams.viewType = this.viewType;
this.controllerParams.withControlPanel = true;
if (params.action && params.action.flags) {
+1 -1
View File
@@ -272,7 +272,7 @@
<a role="menuitem" href="#" data-action="fvg" class="dropdown-item">Fields View Get</a>
<t t-if="can_edit">
<a role="menuitem" href="#" data-action="edit" data-model="ir.ui.view" t-att-data-id="view.fieldsView.view_id" class="dropdown-item">
Edit View: <t t-esc="view.display_name"/>
Edit View: <t t-esc="controller.viewName"/>
</a>
<a t-if="searchview and searchview.$el.is(':visible')" role="menuitem" href="#" data-action="edit" data-model="ir.ui.view" t-att-data-id="action.searchFieldsView.view_id" class="dropdown-item">Edit SearchView</a>
</t>
@@ -52,10 +52,10 @@ QUnit.module('DebugManager', {}, function () {
view_id: 1,
},
type: "list",
display_name: "List",
}],
};
var view = {
viewName: "List",
viewType: "list",
};
debugManager.update('action', action, view);