@@ -9,18 +9,13 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
99
1010 /**
1111 * The Geoengine Controller controls the geo renderer and the geo model.
12- * Its role is to allow these two components to communicate properly, and
13- * also, to render and bind all extra actions in the 'Sidebar'.
12+ * Its role is to allow these two components to communicate properly.
1413 */
1514
16- var core = require ( "web.core" ) ;
1715 var BasicController = require ( "web.BasicController" ) ;
1816 var pyUtils = require ( "web.py_utils" ) ;
19- var Sidebar = require ( "web.Sidebar" ) ;
2017 var DataExport = require ( "web.DataExport" ) ;
2118
22- var _t = core . _t ;
23-
2419 var GeoengineController = BasicController . extend ( {
2520 custom_events : _ . extend ( { } , BasicController . prototype . custom_events , {
2621 selection_changed : "_onSelectionChanged" ,
@@ -31,13 +26,11 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
3126 * @override
3227 * @param {Object } parent node
3328 * @param {Boolean } params.editable
34- * @param {Boolean } params.hasSidebar
3529 * @param {Object } params.toolbarActions
3630 * @param {Boolean } params.noLeaf
3731 */
3832 init : function ( parent , model , renderer , params ) {
3933 this . _super . apply ( this , arguments ) ;
40- this . hasSidebar = params . hasSidebar ;
4134 this . toolbarActions = params . toolbarActions || { } ;
4235 this . noLeaf = params . noLeaf ;
4336 this . selectedRecords = params . selectedRecords || [ ] ;
@@ -106,55 +99,6 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
10699 } ) ;
107100 } ,
108101
109- /**
110- * Render the sidebar (the 'action' menu in the control panel, right of
111- * the main buttons)
112- *
113- * @param {jQuery.Element } $node
114- */
115- renderSidebar : function ( $node ) {
116- if ( this . hasSidebar && ! this . sidebar ) {
117- var other = [
118- {
119- label : _t ( "Export" ) ,
120- callback : this . _onExportData . bind ( this ) ,
121- } ,
122- ] ;
123- if ( this . archiveEnabled ) {
124- other . push ( {
125- label : _t ( "Archive" ) ,
126- callback : this . _onToggleArchiveState . bind ( this , true ) ,
127- } ) ;
128- other . push ( {
129- label : _t ( "Unarchive" ) ,
130- callback : this . _onToggleArchiveState . bind ( this , false ) ,
131- } ) ;
132- }
133- if ( this . is_action_enabled ( "delete" ) ) {
134- other . push ( {
135- label : _t ( "Delete" ) ,
136- callback : this . _onDeleteSelectedRecords . bind ( this ) ,
137- } ) ;
138- }
139- this . sidebar = new Sidebar ( this , {
140- editable : this . is_action_enabled ( "edit" ) ,
141- env : {
142- context : this . model
143- . get ( this . handle , {
144- raw : true ,
145- } )
146- . getContext ( ) ,
147- activeIds : this . getSelectedIds ( ) ,
148- model : this . modelName ,
149- } ,
150- actions : _ . extend ( this . toolbarActions , { other : other } ) ,
151- } ) ;
152- this . sidebar . appendTo ( $node ) ;
153-
154- this . _toggleSidebar ( ) ;
155- }
156- } ,
157-
158102 /**
159103 * Overrides to update the list of selected records
160104 *
@@ -244,51 +188,10 @@ odoo.define("base_geoengine.GeoengineController", function (require) {
244188 . then ( this . update . bind ( this , { } , { reload : false } ) ) ;
245189 } ,
246190
247- /**
248- * @override
249- * @private
250- */
251- _getSidebarEnv : function ( ) {
252- var env = this . _super . apply ( this , arguments ) ;
253- var record = this . model . get ( this . handle ) ;
254- return _ . extend ( env , { domain : record . getDomain ( ) } ) ;
255- } ,
256-
257- /**
258- * Display the sidebar (the 'action' menu in the control panel)
259- * if we have some selected records.
260- */
261- _toggleSidebar : function ( ) {
262- if ( this . sidebar ) {
263- this . sidebar . do_toggle ( this . selectedRecords . length > 0 ) ;
264- }
265- } ,
266-
267- /**
268- * @override
269- * @returns {Deferred }
270- */
271- _update : function ( ) {
272- this . _toggleSidebar ( ) ;
273- return this . _super . apply ( this , arguments ) ;
274- } ,
275-
276191 // --------------------------------------------------------------------
277192 // Handlers
278193 // --------------------------------------------------------------------
279194
280- /**
281- * When the current selection changes (by clicking on the checkboxes on
282- * the left), we need to display (or hide) the 'sidebar'.
283- *
284- * @private
285- * @param {OdooEvent } event
286- */
287- _onSelectionChanged : function ( event ) {
288- this . selectedRecords = event . data . selection ;
289- this . _toggleSidebar ( ) ;
290- } ,
291-
292195 /**
293196 * Called when clicking on 'Archive' or 'Unarchive' in the sidebar.
294197 *
0 commit comments