Guest User

Untitled

a guest
Feb 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.92 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!--mydev.xml-->
  3. <tryton>
  4.     <data>
  5.         <!--
  6.             There is 2 (basic/common) types of "view"
  7.             1. Tree View
  8.             2. Form View
  9.         -->
  10.  
  11.         <!-- View Tree for Theparent-->
  12.         <record model="ir.ui.view" id="mydev_view_tree">
  13.             <field name="model">mydev.theparent</field>
  14.             <field name="type">tree</field>
  15.             <field name="arch" type="xml">
  16.                 <![CDATA[
  17.                <tree string="Mydev The Parent">
  18.                    <field name="name" select="1"/>
  19.                    <field name="desc" />
  20.                </tree>
  21.                ]]>
  22.             </field>
  23.         </record>
  24.  
  25.         <!-- View Form for Theparent-->
  26.        <record model="ir.ui.view" id="mydev_view_form">
  27.             <field name="model">mydev.theparent</field>
  28.             <field name="type">form</field>
  29.             <field name="arch" type="xml">
  30.               <![CDATA[
  31.              <form string="The Parent">
  32.                <label name="Parent Name"/>
  33.                <field name="name"/>
  34.                <label name="Parent Desc"/>
  35.                <field name="desc"/>
  36.              </form>
  37.              ]]>
  38.             </field>
  39.        </record>
  40.  
  41.         <!-- Each Model need to bound to an "action",
  42.         so let's create an action that bound to our model -->
  43.         <record model="ir.action.act_window" id="act_mydev_theparent_form">
  44.             <field name="name">The Parent</field>
  45.             <field name="res_model">mydev.theparent</field>
  46.         </record>
  47.  
  48.         <!--and bound the action to the 2 view we've created above-->      
  49.         <!-- First, bound that action to our view_tree-->
  50.         <record model="ir.action.act_window.view" id="act_mydev_theparent_view1">
  51.             <field name="sequence" eval="10"/>
  52.             <field name="view" ref="mydev_view_tree"/>
  53.             <field name="act_window" ref="act_mydev_theparent_form"/>
  54.         </record>
  55.  
  56.         <!-- And also bound the same action to our view_form-->
  57.         <record model="ir.action.act_window.view" id="act_mydev_theparent_view2">
  58.             <field name="sequence" eval="20"/>
  59.             <field name="view" ref="mydev_view_form"/>
  60.             <field name="act_window" ref="act_mydev_theparent_form"/>
  61.         </record>
  62.        
  63.         <!-- Here we play with "menu-->
  64.         <!-- First we position our module agains existing menu
  65.         For this example, we just put it at the first level of existing menu tree
  66.         -->
  67.         <menuitem name="My Dev" id="menu_mydev" sequence="10"/>
  68.  
  69.         <!-- While we playing with menu,
  70.         lets try to put another "sub menu" before the one that call real action -->
  71.         <menuitem name="Parent Child" parent="menu_mydev" sequence="1"
  72.            id="menu_mydev_parentchild"/>
  73.         <!-- Here is the one which call the real action-->
  74.         <menuitem parent="menu_mydev_parentchild" sequence="1"
  75.            id="menu_mydev_theparent_form" action="act_mydev_theparent_form"/>
  76.     </data>
  77. </tryton>
Add Comment
Please, Sign In to add comment