How to add Two different views for the same model in Odoo 13?
28 January, 2023 by
Umme Huzaifa
| No comments yet

Suppose we want to add two different views for a custom model name 'purchase.req'. One is for the base user and another is for the manager.


<record model="ir.actions.act_window" id="purchase_order_action">
<field name="name">Purchase Requisition</field>
<field name="res_model">purchase.req</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field
                name="view_ids"
                eval="[
                    (5, 0, 0),
                    (0, 0, {'sequence': 1, 'view_mode': 'tree', 'view_id': ref('purchase_req_tree')}),
                    (0, 0, {'sequence': 2, 'view_mode': 'form', 'view_id': ref('purchase_req_form')}),    
                    ]"/>

<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">Create the First Purchase Requisition !
</p>
</field>
</record>


Here reference tree and form view will be called for this action.

Umme Huzaifa
28 January, 2023
Share this post
Archive
Sign in to leave a comment