Hide action/more button in form view in odoo12

天大地大妈咪最大 提交于 2019-12-24 04:15:10

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/56889201/hide-action-more-button-in-form-view-in-odoo12

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!