How To Inherit an Action Button and Add a Confirmation Message in Odoo
14 November, 2022 by
Umme Huzaifa
| No comments yet

Suppose you want to add a confirmation message to a purchase order. Here is an example below:

<record id="view_purchase_order_form_confirm_msg" model="ir.ui.view">
<field name="name">view.purchase.order.form.confirm.msg</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@id='draft_confirm']" position="replace">
<button name="button_confirm" type="object" states="draft"
string="Confirm Order" id="draft_confirm"
confirm="Are you sure you want to Confirm this order? "/>
</xpath>

<xpath expr="//button[@name='button_cancel']" position="replace">
<button name="button_cancel"
states="draft,to approve,sent,purchase"
string="Cancel" type="object"
confirm="Are you sure you want to Cancel this order? "/>
</xpath>
</field>
</record>
Umme Huzaifa
14 November, 2022
Share this post
Archive
Sign in to leave a comment