Help

Hide Buttons of same name in same view ?

Closed
Avatar
Jasad

The question has been closed for reason: not a real question

by
Jasad
on 08/24/2015 08:50:30

For Example: In sale order form view, I wish to hide 'confirm order' button. This button is mentioned twice in view with different states. So what is the best practice to hide the button or replace the button. Please look in to the bold lines of below code. How can I hide those two bold line buttons from the view ?.

<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<form string="Sales Order">
<header>
<button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" groups="base.group_user"/>
<button name="invoice_corrected" states="invoice_except" string="Ignore Exception" groups="base.group_user"/>
<button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
<button name="action_quotation_send" string="Send by Email" type="object" states="sent,progress,manual" groups="base.group_user"/>
<button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
<button name="print_quotation" string="Print" type="object" states="sent,progress,manual" groups="base.group_user"/>
<button name="action_button_confirm" states="draft" string="Confirm Sale" type="object" groups="base.group_user"/>
<button name="action_button_confirm" states="sent" string="Confirm Sale" class="oe_highlight" type="object" groups="base.group_user"/>

<button name="action_view_invoice" string="View Invoice" type="object" class="oe_highlight"
attrs="{'invisible': [('invoice_exists', '=', False)]}" groups="base.group_user"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
type="action" states="manual" class="oe_highlight" groups="base.group_user"/>
<button name="copy_quotation" states="cancel" string="New Copy of Quotation" type="object"/>
<button name="cancel" states="draft,sent" string="Cancel Quotation" groups="base.group_user"/>
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" groups="base.group_user"/>
<button name="invoice_cancel" states="invoice_except" string="Cancel Order" groups="base.group_user"/>
<field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,done" statusbar_colors='{"invoice_except":"red","waiting_date":"blue"}'/>
</header>
2 Comments
Avatar
Discard
Avatar
Tuan
-

Hello,

you can use the xpath ... button[@name='action_button_confirm'][1], button[@name='action_button_confirm'][2]

Avatar
SHIV SHANKAR
-

Why this question has been closed, saying it's not real question. IT IS REAL QUESTION. Please re-open it.