<?xml version="1.0" ?>
<openerp>
<data>

    <menuitem
        id="menu_process"
        name="Enterprise Process"
        parent="base.menu_custom"/>

    <!-- Views for Process -->
    <record model="ir.ui.view" id="view_process_form">
        <field name="name">process.process.form</field>
        <field name="model">process.process</field>
        <field name="arch" type="xml">
            <form string="Process" version="7.0">
                <sheet>
                    <group col="4">
                        <field name="name"/>
                        <field name="model_id"/>
                        <field name="active"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Nodes">
                            <field name="node_ids" colspan="4" nolabel="1">
                                <tree string="Process Nodes">
                                    <field name="name"/>
                                    <field name="model_id"/>
                                    <field name="kind"/>
                                    <field name="flow_start"/>
                                </tree>
                                <form string="Process Node" version="7.0">
                                    <group>
                                        <group>
                                            <field name="name"/>
                                            <field name="flow_start"/>
                                        </group>
                                        <group>
                                            <field name="kind"/>
                                            <field name="subflow_id" attrs="{'invisible':[('kind','!=','subflow')]}"/>
                                        </group>
                                    </group>
                                    
                                    <notebook colspan="4">
                                        <page string="Properties">
                                            <group colspan="4" col="6">
                                                <field name="model_id"/>
                                                <field name="menu_id"/>
                                                <field name="help_url" widget="url"/>
                                            </group>
                                            <separator string="Conditions" colspan="4"/>
                                            <field name="model_states"/>
                                            <field name="condition_ids" nolabel="1" colspan="4">
                                                <tree string="Other Conditions" editable="top">
                                                    <field name="name"/>
                                                    <field name="model_id"/>
                                                    <field name="model_states"/>
                                                </tree>
                                            </field>
                                        </page>
                                        <page string="Transitions">
                                            <group colspan="4" col="4">
                                                <group colspan="2" col="2">
                                                    <field name="transition_in" nolabel="1" height="400">
                                                        <tree string="Incoming Transitions">
                                                            <field name="name"/>
                                                            <field name="source_node_id"/>
                                                        </tree>
                                                    </field>
                                               </group>
                                               <group colspan="2" col="2">
                                                    <field name="transition_out" nolabel="1" height="400">
                                                        <tree string="Outgoing Transitions">
                                                            <field name="name"/>
                                                            <field name="target_node_id"/>
                                                        </tree>
                                                    </field>
                                               </group>
                                            </group>
                                        </page>
                                        <page string="Notes">
                                           <field name="note" nolabel="1" colspan="4"/>
                                        </page>
                                    </notebook>
                                </form>
                            </field>
                        </page>
                        <page string="Notes">
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="view_process_tree">
        <field name="name">process.process.tree</field>
        <field name="model">process.process</field>
        <field name="arch" type="xml">
            <tree string="Process">
                <field name="name"/>
                <field name="model_id"/>
                <field name="active"/>
            </tree>
        </field>
    </record>

    <record id="view_process_filter" model="ir.ui.view">
            <field name="name">process.process.filter</field>
            <field name="model">process.process</field>
            <field name="arch" type="xml">
                <search string="Search Process">
                    <field name="name" string="Process"/>
                    <field name="model_id"/>
                    <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 model="ir.actions.act_window" id="action_process_form">
        <field name="name">Processes</field>
        <field name="res_model">process.process</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_process_filter" />
    </record>
    <menuitem
        id="menu_process_form"
        action="action_process_form"
        parent="menu_process"/>

    <!-- Nodes -->
    <record model="ir.ui.view" id="view_process_node_tree">
        <field name="name">process.node.tree</field>
        <field name="model">process.node</field>
        <field name="arch" type="xml">
            <tree string="Process Nodes">
                <field name="name"/>
                <field name="process_id"/>
                <field name="model_id"/>
                <field name="kind"/>
                <field name="flow_start"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_process_node_form">
        <field name="name">process.node.form</field>
        <field name="model">process.node</field>
        <field name="arch" type="xml">
            <form string="Process Node" version="7.0">
                <sheet layout="auto">
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="process_id"/>
                            <field name="flow_start"/>
                        </group>
                        <group>
                            <field name="kind"/>
                            <field name="subflow_id" attrs="{'invisible':[('kind','!=','subflow')]}"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Properties">
                            <group col="4">
                                <field name="model_id"/>
                                <field name="menu_id"/>
                                <field name="help_url" widget="url"/>
                                <field name="model_states"/>
                            </group>
                            <field name="condition_ids">
                                <tree string="Other Conditions" editable="bottom">
                                    <field name="name"/>
                                    <field name="model_id"/>
                                    <field name="model_states"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Transitions">
                            <field name="transition_in" nolabel="1" height="400">
                                <tree string="Incoming Transitions">
                                    <field name="name"/>
                                    <field name="source_node_id"/>
                                </tree>
                            </field>
                            <field name="transition_out" nolabel="1" height="400">
                                <tree string="Outgoing Transitions">
                                    <field name="name"/>
                                    <field name="target_node_id"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Notes">
                           <field name="note"/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_process_node_filter" model="ir.ui.view">
        <field name="name">process.node.filter</field>
        <field name="model">process.node</field>
        <field name="arch" type="xml">
            <search string="Search ProcessNode">
                <field name="name" string="Process Node"/>
                <field name="kind" />
                <field name="model_id"/>
                <group expand="0" string="Group By...">
                    <filter string="Object" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'model_id'}"/>
                    <filter string="Kind Of Node" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'kind'}"/>
                </group>
            </search>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_process_node_form">
        <field name="name">Process Nodes</field>
        <field name="res_model">process.node</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_process_node_filter" />
    </record>

    <menuitem
        id="menu_process_node_form"
        action="action_process_node_form"
        parent="menu_process"/>

    <!-- Transitions -->

    <record model="ir.ui.view" id="view_process_transition_tree">
        <field name="name">process.transition.tree</field>
        <field name="model">process.transition</field>
        <field name="arch" type="xml">
            <tree string="Process Transition">
                <field name="name"/>
                <field name="source_node_id"/>
                <field name="target_node_id"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_process_transition_form">
        <field name="name">process.transition.form</field>
        <field name="model">process.transition</field>
        <field name="arch" type="xml">
            <form string="Process Transition" version="7.0">
                <sheet >
                    <group col="4">
                        <field name="name"/>
                        <field name="source_node_id"/>
                        <field name="target_node_id"/>
                    </group>
                    <notebook>
                        <page string="Actions">
                            <field name="action_ids">
                                <tree string="Actions">
                                    <field name="name"/>
                                    <field name="state"/>
                                    <field name="action"/>
                                </tree>
                                <form string="Actions" version="7.0">
                                    <group col="4">
                                        <field name="name" colspan="4"/>
                                        <field name="state"/>
                                        <field name="action"/>
                                    </group>
                                </form>
                            </field>
                        </page>
                        <page string="Workflow Transitions">
                            <field name="transition_ids"/>
                        </page>
                        <page string="Associated Groups">
                            <field name="group_ids"/>
                        </page>
                        <page string="Notes">
                            <field name="note"/>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_process_transition_filter" model="ir.ui.view">
        <field name="name">process.transition.filter</field>
        <field name="model">process.transition</field>
        <field name="arch" type="xml">
            <search string="Search Process Transition">
                <field name="name" string="Process Transition"/>
                <field name="source_node_id"/>
                <field name="target_node_id"/>
<!--
                <newline/>
                <group expand="0" string="Group By..." colspan="4" col="4">
                    <filter string="Source Node" icon="terp-personal" domain="[]" context="{'group_by':'source_node_id'}"/>
                    <filter string="Target Node" icon="terp-personal" domain="[]" context="{'group_by':'target_node_id'}"/>
                </group>
-->
            </search>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_process_transition_form">
        <field name="name">Process Transitions</field>
        <field name="res_model">process.transition</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_process_transition_filter" />
    </record>
    <menuitem
        id="menu_process_transition_form"
        action="action_process_transition_form"
        parent="menu_process"/>

</data>
</openerp>
