This question has been flagged
6 Replies
5980 Views

I'm trying to remove the `action_quotation_send` button via a custom module. In my XML I've attempted:

<record id="view_order_form" model="ir.ui.view">

      <field name="name">sale.order.form</field>

      <field name="model">sale.order</field>
      <field name="priority" eval="1"/>
      <field name="inherit_id" ref="sale.view_order_form"/>
      <field name="arch" type="xml">

          <!-- xpath, doesn't work? -->
          <xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="attrs">{'invisible': [('func_field', '=', False)]}</attribute>
          </xpath>

          <!-- straight up removal doesn't work? -->

          <button name="action_quotation_send" position="replace"/>

          <!-- Matching the structure of the original XML doesn't work -->

          <form string="Sales Order">
              <header>

                  <button name="action_quotation_send" position="replace"/>
              </header>
          </form>

      </field>
  </record>

What am I missing?

Avatar
Discard
Best Answer

<xpath expr="//button[@name='action_quotation_send']" position="attributes">

              <attribute name="invisible">1</attribute>

</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">

</xpath>

Avatar
Discard
Best Answer

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>


Avatar
Discard
Best Answer

<xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="invisible">1</attribute>
</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>

Avatar
Discard
Best Answer

<xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="invisible">1</attribute>
</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>

Avatar
Discard
Best Answer

Have you tried to make the button invisable instead of removing it?  It would accomplish the same thing. 

For example... 

<button name="action_quotation_send" position="replace" invisible="1"/>

Avatar
Discard

Yes, better idea, and that way could make invisible base upon Group permissions