Skip to content

Commit

Permalink
[FIX]base_geoengine: replace old web.Sidebar w/ web.ActionMenus
Browse files Browse the repository at this point in the history
  • Loading branch information
PicchiSeba committed Jun 20, 2024
1 parent d9d9a3b commit 3b7f9c8
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
/**
* The Geoengine Controller controls the geo renderer and the geo model.
* Its role is to allow these two components to communicate properly, and
* also, to render and bind all extra actions in the 'Sidebar'.
* also, to render and bind all extra actions in the 'ActionMenus'.
*/

var core = require("web.core");
var BasicController = require("web.BasicController");
var pyUtils = require("web.py_utils");
var Sidebar = require("web.Sidebar");
var ActionMenus = require("web.ActionMenus");
var DataExport = require("web.DataExport");

var _t = core._t;
Expand All @@ -31,13 +31,13 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
* @override
* @param {Object} parent node
* @param {Boolean} params.editable
* @param {Boolean} params.hasSidebar
* @param {Boolean} params.hasActionMenus
* @param {Object} params.toolbarActions
* @param {Boolean} params.noLeaf
*/
init: function (parent, model, renderer, params) {
this._super.apply(this, arguments);
this.hasSidebar = params.hasSidebar;
this.hasActionMenus = params.hasActionMenus;
this.toolbarActions = params.toolbarActions || {};
this.noLeaf = params.noLeaf;
this.selectedRecords = params.selectedRecords || [];
Expand Down Expand Up @@ -112,8 +112,8 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
*
* @param {jQuery.Element} $node
*/
renderSidebar: function ($node) {
if (this.hasSidebar && !this.sidebar) {
renderActionMenus: function ($node) {
if (this.hasActionMenus && !this.sidebar) {
var other = [
{
label: _t("Export"),
Expand All @@ -136,7 +136,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
callback: this._onDeleteSelectedRecords.bind(this),
});
}
this.sidebar = new Sidebar(this, {
this.sidebar = new ActionMenus(this, {
editable: this.is_action_enabled("edit"),
env: {
context: this.model
Expand All @@ -151,7 +151,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
});
this.sidebar.appendTo($node);

this._toggleSidebar();
this._toggleActionMenus();
}
},

Expand Down Expand Up @@ -248,7 +248,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
* @override
* @private
*/
_getSidebarEnv: function () {
_getActionMenusEnv: function () {
var env = this._super.apply(this, arguments);
var record = this.model.get(this.handle);
return _.extend(env, {domain: record.getDomain()});
Expand All @@ -258,7 +258,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
* Display the sidebar (the 'action' menu in the control panel)
* if we have some selected records.
*/
_toggleSidebar: function () {
_toggleActionMenus: function () {
if (this.sidebar) {
this.sidebar.do_toggle(this.selectedRecords.length > 0);
}
Expand All @@ -269,7 +269,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
* @returns {Deferred}
*/
_update: function () {
this._toggleSidebar();
this._toggleActionMenus();
return this._super.apply(this, arguments);
},

Expand All @@ -286,7 +286,7 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
*/
_onSelectionChanged: function (event) {
this.selectedRecords = event.data.selection;
this._toggleSidebar();
this._toggleActionMenus();
},

/**
Expand Down

0 comments on commit 3b7f9c8

Please sign in to comment.