Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How do I remove a button from the sale.order.form?

By
Kit Sunde
on 8/20/14, 3:36 PM 1,020 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?

2
John Doe
On 8/21/14, 6:08 AM

<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>

4

Janeesh

--Janeesh--
1641
| 4 3 4
Cochin, India
--Janeesh--

Odoo Developer

Janeesh
On 8/21/14, 12:49 AM

You can try two things.

<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>

0
Nate Foster
On 8/20/14, 6:28 PM

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"/>

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

EUGE Consulting, E.R. Spada II
on 8/30/14, 1:48 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/20/14, 3:36 PM
Seen: 1020 times
Last updated: 3/16/15, 8:10 AM