[REF] web: improved fix from 'Edit View: X' (017e7132)
Revision on https://github.com/odoo/odoo/commit/017e71322b6b7f0c232f0d66ba659a5972fc3534 Commit above correctly fixes an issue with 'Edit View: X' menu item in the debug manager, in which the name of the view was missing. To do so, it lets the controller be aware of the name of the view, so that it can be used in the template of the debug menu. However, we think there is a much better solution to fixing this issue: since the debug manager has knowledge of the view action, we can extend this object with the name of the view. This is exactly what this commit does: extend the action view object so that it knows the name of the view. That way, the template is much more readable, as `view.displayName` is more meaningful than `controller.viewName`. Task-ID 1878254
This commit is contained in:
@@ -429,6 +429,7 @@ ActionManager.include({
|
||||
if (View) {
|
||||
views.push({
|
||||
accessKey: View.prototype.accessKey || View.prototype.accesskey,
|
||||
displayName: View.prototype.display_name,
|
||||
fieldsView: fieldsView,
|
||||
icon: View.prototype.icon,
|
||||
isMobileFriendly: View.prototype.mobile_friendly,
|
||||
|
||||
@@ -43,8 +43,6 @@ 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
|
||||
@@ -71,7 +69,6 @@ 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,7 +153,6 @@ 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) {
|
||||
|
||||
@@ -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="controller.viewName"/>
|
||||
Edit View: <t t-esc="view.displayName"/>
|
||||
</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>
|
||||
|
||||
@@ -48,6 +48,7 @@ QUnit.module('DebugManager', {}, function () {
|
||||
// Simulate update debug manager from web client
|
||||
var action = {
|
||||
views: [{
|
||||
displayName: "List",
|
||||
fieldsView: {
|
||||
view_id: 1,
|
||||
},
|
||||
@@ -55,7 +56,6 @@ QUnit.module('DebugManager', {}, function () {
|
||||
}],
|
||||
};
|
||||
var view = {
|
||||
viewName: "List",
|
||||
viewType: "list",
|
||||
};
|
||||
debugManager.update('action', action, view);
|
||||
|
||||
Reference in New Issue
Block a user