Skip to Content
Menu
This question has been flagged
1 Reply
17212 Views

Hello,

I have Sales Order model and Sales Order model with additional fields. I use them in different ways.

One sales order must stay default, another have additional fields.


I have created another Menu and Tree View. 

I cannot find how may i change Form View that is beeing opened after clicking "Create" in Tree view. ?


Avatar
Discard
Best Answer

You can define different tree view,form view actions for models. Below code may be help you.

<record id="action_hotel_invoice_tree1" model="ir.actions.act_window">

    <field name="name">Hotel Invoices</field>

    <field name="res_model">account.invoice</field>

    <field name="view_type">form</field>

    <field name="view_mode">tree,form</field>

    <field eval="False" name="view_id"/>

    <field name="domain">[('type','in',('out_invoice', 'out_refund')),('is_hotel_invoice','=',True)]</field>

    <field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>

    <field name="search_view_id" ref="account.view_account_invoice_filter"/>

</record>

<record id="action_hotel_invoice_tree1_view1" model="ir.actions.act_window.view">

    <field eval="1" name="sequence"/>

    <field name="view_mode">tree</field>

    <field name="view_id" ref="your_new_tree_view_id"/>

    <field name="act_window_id" ref="action_hotel_invoice_tree1"/>

</record>

<record id="action_hotel_invoice_tree1_view2" model="ir.actions.act_window.view">

    <field eval="2" name="sequence"/>

    <field name="view_mode">form</field>

    <field name="view_id" ref="your_new_form_view_id"/>

    <field name="act_window_id" ref="action_hotel_invoice_tree1"/>

</record>

<menuitem  name="Hotel Invoice" id="menu_hotel_invoices"  action="action_hotel_invoice_tree1"   parent="menu_hotel_reservation"/>' 

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 15
3852
0
Mar 15
3055
0
Jun 24
997
3
May 24
5920
0
Feb 24
561