Based on Create two graph view for one model openerp I've made 2 different tree views for one model in Odoo V8.0. This works fine.
But now I also want to add form views for those 2 tree views. When I add a form view in the .xml, everything becomes messed up. I've tried many different orders in de .xml but I can't really get it fixed.
When I just remove the form from the .xml, the form shows ALL fields of the model. I only want to display some of them.
This is my views.xml:
<openerp>
<data>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_tree</field>
<field name="model">opc_tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Taginstellingen">
<group colspan="1" col="4">
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_tree</field>
<field name="model">opc_tags</field>
<field name="arch" type="xml">
<tree delete="false">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Actuele waarden tags">
<group colspan="1" col="4">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</group>
</form>
</field>
</record>
<record id="action_taginstellingen" model="ir.actions.act_window">
<field name="name">OPC Taginstellingen</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_instellingen_id"/>
</record>
<record id="action_tagwaarden" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_actuele_waarden_id"/>
</record>
<menuitem id="Toplevel" name="OPC Instellingen"/>
<menuitem id="Submenu" parent="Toplevel" name="OPC Instellingen"/>
<menuitem action="action_taginstellingen" id="menu_taginstellingen_id" sequence="1" name="OPC Taginstellingen" parent="Submenu"/>
<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>
</data>
</openerp>
The problems with this .xml are:
When I click "OPC Taginstellingen" in the menu it shows the form "opc_taginstellingen_form" instead of the tree "opc_taginstellingen_tree".
When I click "OPC Actuele waarden" in the menu it shows the form "opc_actuelewaardentags_form" instead of the tree "opc_actuelewaardentags_tree".
When I change the view from form to list in the front-end, it just shows the title "Created by". So it doesn't go to "opc_taginstellingen_tree" "opc_actuelewaardentags_tree" at all.
How it should be:
When clicking "OPC Taginstellingen" in the menu: Show tree "opc_taginstellingen_tree". When clicking the button create ==> go to "opc_taginstellingen_form".
When clicking "OPC Actuele waarden" in the menu: Show tree "opc_actuelewaardentags_tree". When clicking the button create ==> go to "opc_actuelewaardentags_form".