Search code examples
odooodoo-12

Hide action/more button in form view in odoo12


I want to hide only action/more button not print button in odoo12. I found some similar question its not working in odoo12.


Solution

  • Not a decent answer, but a direction for you. In source code(my version is 11)
    odoo-11.0/addons/web/static/src/js/chrome/sidebar.js L#34

        init: function (parent, options) {
            this._super.apply(this, arguments);
            this.options = _.defaults(options || {}, {
                'editable': true
            });
            this.env = options.env;
            this.sections = options.sections || [
                {name: 'print', label: _t('Print')},
                /* disable this line
                {name: 'other', label: _t('Action')},
                */
            ];
    

    This can remove action button not only in form view, but also include list view.

    Or in odoo-11.0/addons/web/static/src/xml/base.xml L#326

    <t t-name="Sidebar">
        <t t-foreach="widget.sections" t-as="section">
            <div class="btn-group o_dropdown">
                <button t-if="section.name != 'buttons'" class="o_dropdown_toggler_btn btn btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <t t-if="section.name == 'files'" t-raw="widget.items[section.name].length || ''"/>
                    <t t-esc="section.label"/> <span class="caret"/>
                </button>
    

    Maybe you can consider to attach some if-condition for removing action button in form view from these file.