KbiR
KbiR

Reputation: 4174

Remove print button from Form and List view Odoo 8

I need to remove Print button from Form and List view. I tried below code for Form view.

*.xml

<xpath expr="//form" position="attributes">
    <attribute name="print">1</attribute>
</xpath>

*.js

instance.web.FormView.include({
    load_form: function(data) {
        this._super(data);
        console.log('this',this.sidebar);
        if (this.is_action_enabled('print')) {
          var no_print = _.reject(this.sidebar.sections, function (item) {
              return item.label === _t('Print');
              });
              this.sections = no_print;
        }
      },
    });

But getting this error: this object has no attribute sidebar.

NOTE: console log prints two times, first it prints with some data second it prints undefined.

Upvotes: 0

Views: 1998

Answers (2)

Walid Mashal
Walid Mashal

Reputation: 342

Adding the attribute menu="False" to one of your report tags will do the trick for you

Upvotes: 1

jo541
jo541

Reputation: 1155

Would you like remove the print from only one view of the model or for each view of the model?

Upvotes: 0

Related Questions