<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- model -->
        <record id="view_model_form" model="ir.ui.view">
            <field name="model">ir.model</field>
            <field name="arch" type="xml">
                <form string="Model Description" version="7.0">
                  <sheet>
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="model"/>
                            <field name="osv_memory"/>
                        </group>
                        <group>
                            <field name="state"/>
                            <field name="modules"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Fields">
                            <field context="{'manual':True}" name="field_id">
                                <tree string="Fields Description">
                                    <field name="name"/>
                                    <field name="field_description"/>
                                    <field name="ttype"/>
                                    <field name="required"/>
                                    <field name="readonly"/>
                                    <field name="select_level"/>
                                    <field name="state"/>
                                </tree>
                                <form string="Fields Description" version="7.0">
                                    <group col="4">
                                        <field name="name"/>
                                        <field name="state"/>
                                        <field name="field_description"/>
                                    </group>
                                    <group string="Properties">
                                        <group>
                                            <field name="ttype"/>
                                            <field name="relation" attrs="{'required': [('ttype','in',['many2one','one2many','many2many'])],'readonly': [('ttype','!=','one2many'), ('ttype','!=','many2one'), ('ttype','!=','many2many')]}"/>
                                            <field name="relation_field" attrs="{'required': [('ttype','=','one2many')], 'readonly': [('ttype','!=','one2many')]}"/>
                                            <field name="selection" attrs="{'required': [('ttype','in',['selection','reference'])], 'readonly': [('ttype','not in',['selection','reference'])]}"/>
                                            <field name="size" attrs="{'required': [('ttype','in',['char','reference'])], 'readonly': [('ttype','not in',['char','reference'])]}"/>
                                            <field name="domain" attrs="{'readonly': [('relation','=','')]}"/>
                                            <field name="serialization_field_id" attrs="{'readonly': [('state','=','base')]}" domain="[('ttype','=','serialized'), ('model_id', '=', parent.model)]"/>
                                        </group>
                                        <group>
                                            <field name="required"/>
                                            <field name="readonly"/>
                                            <field name="select_level"/>
                                            <field name="translate"/>
                                            <field name="on_delete" attrs="{'readonly': [('ttype','!=','many2one')]}"/>
                                            <field name="modules"/>
                                        </group>
                                    </group>
                                    <separator string="Groups"/>
                                    <field name="groups"/>
                                </form>
                            </field>
                            <button
                                icon="gtk-justify-fill"
                                name="%(act_menu_create)d"
                                string="Create a Menu" type="action"
                                target="new" />
                        </page>
                        <page string="Access Rights">
                            <field name="access_ids">
                                <tree string="Access Rules" editable="bottom">
                                    <field name="group_id"/>
                                    <field name="perm_read"/>
                                    <field name="perm_write"/>
                                    <field name="perm_create"/>
                                    <field name="perm_unlink"/>
                                    <field name="name"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Notes">
                            <field name="info"/>
                        </page>
                        <page string="Views">
                            <field name="view_ids"/>
                        </page>
                    </notebook>
                  </sheet>
                </form>
            </field>
        </record>
        <record id="view_model_tree" model="ir.ui.view">
            <field name="model">ir.model</field>
            <field name="arch" type="xml">
                <tree string="Model Description">
                    <field name="model"/>
                    <field name="name"/>
                    <field name="state"/>
                    <field name="osv_memory"/>
                </tree>
            </field>
        </record>
        <record id="view_model_search" model="ir.ui.view">
            <field name="model">ir.model</field>
            <field name="arch" type="xml">
                <search string="Model Description">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('model','ilike',self)]" string="Model"/>
                    <filter icon="terp-camera_test"
                        string="In Memory"
                        domain="[('osv_memory', '=', True)]"/>
                    <separator/>
                    <filter icon="terp-stock_align_left_24"
                        string="Custom"
                        domain="[('state', '=', 'manual')]"/>
                    <filter icon="terp-translate"
                        string="Base"
                        domain="[('state', '=', 'base')]"/>
                </search>
            </field>
        </record>
        <record id="action_model_model" model="ir.actions.act_window">
            <field name="name">Models</field>
            <field name="res_model">ir.model</field>
            <field name="view_type">form</field>
            <field name="context">{'manual':True}</field>
            <field name="view_id" ref="view_model_tree"/>
        </record>
        <menuitem id="next_id_9" name="Database Structure" parent="base.menu_custom" groups="base.group_no_one"/>
        <menuitem action="action_model_model" id="ir_model_model_menu" parent="next_id_9"/>

        <!-- ir model fields -->
        <record id="view_model_fields_form" model="ir.ui.view">
            <field name="model">ir.model.fields</field>
            <field name="arch" type="xml">
                <form string="Fields" version="7.0">
                  <sheet>
                    <group>
                        <group>
                            <field name="name" string="Field Name"/>
                            <field name="field_description"/>
                        </group>
                        <group>
                            <field name="state"/>
                            <field name="model_id" attrs="{'readonly': [('state','!=', 'manual')]}"/>
                            <field name="modules"/>
                        </group>
                    </group>
                    <group>
                        <group>
                            <field name="ttype"/>
                            <field name="relation" attrs="{'required': [('ttype','in', ['many2one','one2many','many2many'])],
                                                                          'readonly': [('ttype','not in', ['many2one','one2many','many2many'])]}"/>
                            <field name="relation_field" attrs="{'required': [('ttype','=','one2many')], 'readonly': [('ttype','!=','one2many')]}"/>
                            <field name="selection" attrs="{'required': [('ttype','in',['selection','reference'])], 'readonly': [('ttype','not in',['selection','reference'])]}"/>
                            <field name="size" attrs="{'invisible': [('ttype','not in',['char','text','reference'])]}"/>
                            <field name="domain" attrs="{'readonly': [('relation','=','')]}"/>
                            <field name="serialization_field_id" attrs="{'readonly': [('state','=','base')]}" domain="[('ttype','=','serialized'), ('model_id', '=', model_id)]"/>
                            <field name="on_delete" attrs="{'readonly': [('ttype','!=','many2one')]}"/>
                        </group>
                        <group>
                            <field name="required"/>
                            <field name="readonly"/>
                            <field name="select_level"/>
                            <field name="translate"/>
                        </group>
                    </group>
                    <field name="groups" invisible="1"/>
                  </sheet>
                </form>
            </field>
        </record>
        <record id="view_model_fields_tree" model="ir.ui.view">
            <field name="model">ir.model.fields</field>
            <field name="arch" type="xml">
                <tree string="Fields">
                    <field name="name"/>
                    <field name="field_description"/>
                    <field name="model_id"/>
                    <field name="ttype"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="view_model_fields_search" model="ir.ui.view">
            <field name="model">ir.model.fields</field>
            <field name="arch" type="xml">
                <search string="Fields">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('field_description','ilike',self)]" string="Field"/>
                    <filter icon="terp-gnome-cpu-frequency-applet+"
                        string="Required"
                        domain="[('required', '=', True)]"/>
                    <separator/>
                    <filter icon="terp-dialog-close"
                        string="Readonly"
                        domain="[('readonly', '=', True)]"/>
                    <separator/>
                    <filter icon="terp-translate"
                        string="Translate"
                        domain="[('translate', '=', True)]"/>
                    <field name="model_id"/>
                    <field name="ttype"/>
                    <field name="required"/>
                    <field name="readonly"/>
                    <group expand="0" string="Group By...">
                        <filter string="Object" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'model_id'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="action_model_fields" model="ir.actions.act_window">
            <field name="name">Fields</field>
            <field name="res_model">ir.model.fields</field>
            <field name="view_type">form</field>
            <field name="context">{'manual':True}</field>
            <field name="view_id" ref="view_model_fields_tree"/>
        </record>
        <menuitem action="action_model_fields" id="ir_model_model_fields" parent="base.next_id_9"/>

        <!-- ir model data -->
        <record model="ir.ui.view" id="view_model_data_form">
            <field name="model">ir.model.data</field>
            <field name="arch" type="xml">
                <form string="External Identifiers" version="7.0">
                  <group>
                    <group>
                        <field name="complete_name"/>
                        <field name="module"/>
                        <field name="name"/>
                    </group>
                    <group>
                        <field name="display_name"/>
                        <field name="model"/>
                        <field name="res_id"/>
                    </group>
                    <group>
                        <field name="noupdate"/>
                        <field name="date_update" />
                        <field name="date_init" />
                    </group>
                  </group>
                </form>
            </field>
        </record>
        <record id="view_model_data_list" model="ir.ui.view">
            <field name="model">ir.model.data</field>
            <field name="arch" type="xml">
                <tree string="External Identifiers">
                    <field name="complete_name"/>
                    <field name="display_name"/>
                    <field name="model" groups="base.group_no_one"/>
                    <field name="res_id"/>
                </tree>
            </field>
        </record>
        <record id="view_model_data_search" model="ir.ui.view">
            <field name="model">ir.model.data</field>
            <field name="arch" type="xml">
                <search string="External Identifiers">
                    <field name="name" filter_domain="[('name','ilike',self)]" string="External Identifier"/>
                    <filter string="Updatable" domain="[('noupdate', '=', False)]"/>
                    <field name="module"/>
                    <field name="model"/>
                    <field name="res_id"/>
                    <field name="noupdate"/>
                    <group expand="0" string="Group By...">
                        <filter string="Module" icon="terp-folder-blue" domain="[]" context="{'group_by':'module'}"/>
                        <filter string="Object" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'model'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="action_model_data" model="ir.actions.act_window">
            <field name="name">External Identifiers</field>
            <field name="res_model">ir.model.data</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_model_data_list"/>
        </record>
        <menuitem id="next_id_5" name="Sequences &amp; Identifiers" parent="base.menu_custom" sequence="21" groups="base.group_no_one"/>
        <menuitem action="action_model_data" id="ir_model_data_menu" parent="base.next_id_5"
                  groups="base.group_no_one"/>

        <!-- ir model contraints -->
        <record model="ir.ui.view" id="view_model_constraint_form">
            <field name="model">ir.model.constraint</field>
            <field name="arch" type="xml">
                <form string="Model Constraints">
                    <field name="type"/>
                    <field name="name"/>
                    <field name="module"/>
                    <field name="model"/>
                    <newline/>
                    <field name="date_update" />
                    <field name="date_init" />
                </form>
            </field>
        </record>
        <record id="view_model_constraint_list" model="ir.ui.view">
            <field name="model">ir.model.constraint</field>
            <field name="arch" type="xml">
                <tree string="Model Constraints">
                    <field name="type"/>
                    <field name="name"/>
                    <field name="module"/>
                    <field name="model"/>
                </tree>
            </field>
        </record>
        <record id="action_model_constraint" model="ir.actions.act_window">
            <field name="name">Model Constraints</field>
            <field name="res_model">ir.model.constraint</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_model_constraint_list"/>
        </record>
        <menuitem action="action_model_constraint" id="ir_model_constraint_menu" parent="base.next_id_9"
                  groups="base.group_no_one"/>

        <!-- ir model relations -->
        <record model="ir.ui.view" id="view_model_relation_form">
            <field name="model">ir.model.relation</field>
            <field name="arch" type="xml">
                <form string="ManyToMany Relations">
                    <field name="name"/>
                    <field name="module"/>
                    <field name="model"/>
                    <newline/>
                    <field name="date_update" />
                    <field name="date_init" />
                </form>
            </field>
        </record>
        <record id="view_model_relation_list" model="ir.ui.view">
            <field name="model">ir.model.relation</field>
            <field name="arch" type="xml">
                <tree string="ManyToMany Relations">
                    <field name="name"/>
                    <field name="module"/>
                    <field name="model"/>
                </tree>
            </field>
        </record>
        <record id="action_model_relation" model="ir.actions.act_window">
            <field name="name">ManyToMany Relations</field>
            <field name="res_model">ir.model.relation</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_model_relation_list"/>
        </record>
        <menuitem action="action_model_relation" id="ir_model_relation_menu" parent="base.next_id_9"
                  groups="base.group_no_one"/>

        <!-- ir.model.access -->
        <record id="ir_access_view_tree" model="ir.ui.view">
            <field name="model">ir.model.access</field>
            <field name="arch" type="xml">
                <tree string="Access Controls" editable="bottom">
                    <field name="name"/>
                    <field name="model_id"/>
                    <field name="group_id"/>
                    <field name="perm_read"/>
                    <field name="perm_write"/>
                    <field name="perm_create"/>
                    <field name="perm_unlink"/>
                </tree>
            </field>
        </record>
        <record id="ir_access_view_form" model="ir.ui.view">
            <field name="model">ir.model.access</field>
            <field name="arch" type="xml">
                <form string="Access Controls" version="7.0">
                   <sheet>
                    <group col="4">
                        <field name="name"/>
                        <field name="model_id"/>
                        <field name="group_id"/>
                        <field name="active"/>
                    </group>
                    <group string="Access" col="4">
                        <field name="perm_read"/>
                        <field name="perm_write"/>
                        <field name="perm_create"/>
                        <field name="perm_unlink"/>
                    </group>
                   </sheet> 
                </form>
            </field>
        </record>
        <record id="ir_access_view_search" model="ir.ui.view">
            <field name="model">ir.model.access</field>
            <field name="arch" type="xml">
                <search string="Access Controls">
                    <field name="name" string="Access Control"/>
                    <filter string="Global" icon="terp-stage" domain="[('group_id','=',False)]"/>
                    <separator/>
                    <filter string="Full Access" icon="terp-gtk-select-all" domain="[('perm_read','=',True),('perm_write','=',True),('perm_create','=',True),('perm_unlink','=',True)]"/>
                    <filter string="Read Access" icon="terp-stock_align_left_24" domain="[('perm_read','=',True)]"/>
                    <filter string="Write Access" icon="terp-tools" domain="[('perm_write','=',True)]"/>
                    <field name="model_id"/>
                    <field name="group_id"/>
                    <group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_no_one">
                        <filter string="Group" icon="terp-personal" domain="[]" context="{'group_by':'group_id'}"/>
                        <filter string="Object" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'model_id'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="ir_access_act" model="ir.actions.act_window">
            <field name="name">Access Controls List</field>
            <field name="res_model">ir.model.access</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="ir_access_view_tree"/>
            <field name="search_view_id" ref="ir_access_view_search"/>
        </record>
        <menuitem action="ir_access_act" id="menu_ir_access_act" parent="base.menu_security"/>

    </data>
</openerp>
