javascriptpythonxmlodooodoo-14

How to remove "Export" action menu?


I would like to remove "Export" in action menu in Odoo 14 Community Edition.

I want to remove it for all views at once if possible; otherwise, one by one for each required model or view would be fine.

Export action menu

I tried:

<xpath expr="//tree" position="attributes">
  <attribute name="export_xlsx">false</attribute>
</xpath>

in individual model. Doesn't work.

Also tried overwriting the Sidebar in javascript. Doesn't work.


Solution

  • Do it using this js code

    odoo.define('disable_export', function (require) {
    "use strict";
    
    const ListView = require('web.ListView');
    const ListController = require('web.ListController');
    
    ListView.include({
      init: function (viewInfo, params) {
        this._super.apply(this, arguments);
        this.controllerParams.activeActions.export_xlsx = false;
      }
    })
    
    ListController.include({
      _getActionMenuItems: function (state) {
        this.isExportEnable = false;
        return this._super.apply(this, arguments);
      }
    })
    
    })