<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <!-- Modules Categories -->

        <record id="view_module_category_form" model="ir.ui.view">
            <field name="name">ir.module.category.form</field>
            <field name="model">ir.module.category</field>
            <field name="type">form</field>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <form string="Module Category">
                    <field colspan="4" name="name"/>
                    <field colspan="4" name="parent_id"/>
                </form>
            </field>
        </record>

        <record id="view_module_category_tree" model="ir.ui.view">
            <field name="name">ir.module.category.tree</field>
            <field name="model">ir.module.category</field>
            <field name="type">tree</field>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree string="Module Category">
                    <field name="name"/>
                    <field name="module_nr"/>
                </tree>
            </field>
        </record>

        <!-- Click on a category -->

        <record id="view_module_filter" model="ir.ui.view">
            <field name="name">ir.module.module.list.select</field>
            <field name="model">ir.module.module</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search modules">
                    <group col='10' colspan='4'>
                        <filter icon="terp-check" string="Installed" domain="[('state', 'in', ['installed', 'to upgrade', 'to remove'])]"/>
                        <filter icon="terp-dialog-close" string="Not Installed" domain="[('state', 'in', ['uninstalled', 'uninstallable'])]"/>
                        <filter icon="terp-gtk-jump-to-ltr" string="To be upgraded" domain="[('state','in', ['to upgrade', 'to remove', 'to install'])]"/>
                        <separator orientation="vertical"/>
                        <filter icon="terp-camera_test" string="Certified" domain="[('certificate','&lt;&gt;', False)]"/>
                        <separator orientation="vertical"/>
                        <field name="name"/>
                        <field name="description"/>
                        <field name="dependencies_id"/>
                        <field name="state"/>
                    </group>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_extended">
                        <filter string="Author" icon="terp-personal" domain="[]" context="{'group_by':'author'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category_id'}"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                    </group>
               </search>
            </field>
        </record>


        <record id="action_module_open_categ" model="ir.actions.act_window">
            <field name="name">Modules</field>
            <field name="res_model">ir.module.module</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('category_id','=',active_id)]</field>

        </record>
        <record id="ir_action_module_category" model="ir.values">
            <field eval="'tree_but_open'" name="key2"/>
            <field eval="'ir.module.category'" name="model"/>
            <field name="name">Categorized Modules</field>
            <field eval="'ir.actions.act_window,%d'%action_module_open_categ" name="value"/>
            <field eval="True" name="object"/>
        </record>


        <!-- Modules -->

        <record id="module_form" model="ir.ui.view">
            <field name="name">ir.module.module.form</field>
            <field name="model">ir.module.module</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Module">
                    <field name="name" select="1"/>
                    <field name="certificate" />
                    <field colspan="4" name="shortdesc" select="2"/>
                    <field name="category_id"/>
                    <field name="demo" readonly="1"/>
                    <notebook colspan="4">
                        <page string="Module">
                            <group colspan="4" col="4">
                                <group colspan="2" col="2">
                                    <separator string="Author" colspan="2"/>
                                    <field name="author" select="2"/>
                                    <field name="license"/>
                                    <field name="website" select="2" widget="url" string="Author Website"/>
                                </group>
                                <group colspan="2" col="2">
                                    <separator string="Version" colspan="2"/>
                                    <field name="installed_version"/>
                                    <field name="latest_version"/>
                                    <field name="published_version"/>
                                </group>
                            </group>
                            <separator string="Description" colspan="4"/>
                            <field colspan="4" name="description" select="2" nolabel="1"/>
                            <newline/>
                            <field name="state" readonly="1" select="1"/>
                            <group col="6" colspan="2">
                                <button name="button_install" states="uninstalled" string="Schedule for Installation" icon="terp-gtk-jump-to-ltr" type="object"/>
                                <button name="button_install_cancel" states="to install" string="Cancel Install" icon="gtk-cancel" type="object"/>
                                <button name="button_uninstall" states="installed" string="Uninstall (beta)" icon="terp-dialog-close" type="object"/>
                                <button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" icon="gtk-cancel" type="object"/>
                                <button name="button_upgrade" states="installed" string="Schedule Upgrade" icon="terp-gtk-go-back-rtl" type="object"/>
                                <button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" icon="gtk-cancel" type="object"/>
                            </group>
                        </page>
                        <page string="Dependencies">
                            <field colspan="4" name="dependencies_id" nolabel="1">
                                <tree string="Dependencies">
                                    <field name="name"/>
                                    <field name="state"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Features" attrs="{'invisible':[('state','!=','installed')]}">
                            <separator string="Created Menus" colspan="4"/>
                            <field colspan="4" name="menus_by_module" nolabel="1"/>
                            <separator string="Created Views" colspan="2"/>
                            <separator string="Defined Reports" colspan="2"/>
                            <field colspan="2" name="views_by_module" nolabel="1"/>
                            <field colspan="2" name="reports_by_module" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="module_tree" model="ir.ui.view">
            <field name="name">ir.module.module.tree</field>
            <field name="model">ir.module.module</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree colors="blue:state=='to upgrade' or state=='to install';red:state=='uninstalled';grey:state=='uninstallable';black:state=='installed'" string="Modules">
                    <field name="name"/>
                    <field name="category_id"/>
                    <field name="shortdesc"/>
                    <field name="author"/>
                    <field name="installed_version"/>
                    <field name="latest_version"/>
                    <field name="state"/>
                    <button name="button_install" states="uninstalled" string="Schedule for Installation" icon="terp-gtk-jump-to-ltr" type="object"/>
                    <button name="button_install_cancel" states="to install" string="Cancel Install" icon="gtk-cancel" type="object"/>
                    <button name="button_upgrade" states="installed" string="Schedule Upgrade" icon="terp-gtk-go-back-rtl" type="object"/>
                    <button name="button_uninstall" states="installed" string="Uninstall (beta)" icon="terp-dialog-close" type="object"/>
                    <button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" icon="gtk-cancel" type="object"/>
                    <button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" icon="gtk-cancel" type="object"/>
                </tree>
            </field>
        </record>
        <record id="open_module_tree" model="ir.actions.act_window">
            <field name="name">Modules</field>
            <field name="res_model">ir.module.module</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain"/>
             <field name="search_view_id" ref="view_module_filter"/>
        </record>
        <menuitem action="open_module_tree" id="menu_module_tree" parent="base.menu_management"/>

    </data>
</openerp>
