Monday 25 September 2017

Override xml action in odoo

Yes, you can override the xml action in Odoo any version like below.

Here i will tell how Sale Order action can be override by example.

Default Sales Orders action is

<record id="action_orders" model="ir.actions.act_window">
            <field name="name">Sales Orders</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
            <field name="search_view_id" ref="sale_order_view_search_inherit_sale"/>
            <field name="context">{}</field>
            <field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Create a Quotation, the first step of a new sale.
                </p><p>
                    Once the quotation is confirmed, it becomes a sales order.
                    You'll be able to invoice it and collect payments.
                    From the <i>Sales Orders</i> menu, you can track delivery
                    orders or services.
                </p>
        </field>
</record>

To override just change that part which you want to change and add module name before external id of action like below...

<record id="sale.action_orders" model="ir.actions.act_window">
       <field name="domain">[('is_a_booking','=',False),('state', 'not in', ('draft', 'sent', 'cancel'))]</field>

   </record>

Thanks.
Share:

5 comments:

  1. Hey buddy!! What amazing and useful information you are sharing here, thanks for sharing. I would love to share this information on mine post also so that the visitors of my blog also get a chance to become familiar with this information.

    Odoo Development Company India |
    Hire Odoo developers India

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete