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

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

    <!-- 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="type">form</field>
        <field name="arch" type="xml">
            <form string="Process">
                <group colspan="4" col="6">
                    <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" select="1"/>
                                <field name="kind" select="1"/>
                                <field name="flow_start"/>
                            </tree>
                            <form string="Process Node">
                                <group colspan="4" col="4">
                                    <field name="name"/>
                                    <field name="flow_start"/>
                                    <field name="kind" select="1"/>
                                    <field name="subflow_id" attrs="{'invisible':[('kind','!=','subflow')]}"/>

                                </group>
                                <notebook colspan="4">
	                                <page string="Properties">
		                                <group colspan="4" col="6">
		                                    <field name="model_id" select="1"/>
		                                    <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>
            </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="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Process">
                <field name="name"/>
                <field name="model_id" select="1"/>
                <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="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Process">
                    <group col="10" colspan="4">
                        <field name="name"/>
                        <field name="model_id"/>
                    </group>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="4">
                        <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="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Process Nodes">
                <field name="name"/>
                <field name="process_id" select="1"/>
                <field name="model_id" select="1"/>
                <field name="kind" select="1"/>
                <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="type">form</field>
        <field name="arch" type="xml">
            <form string="Process Node">
                <group colspan="4" col="6">
                    <field name="name"/>
                    <field name="process_id"/>
                    <field name="flow_start"/>
                    <field name="kind" select="1"/>
                    <field name="subflow_id" attrs="{'invisible':[('kind','!=','subflow')]}"/>

                </group>
                <notebook colspan="4">
	                <page string="Properties">
		                <group colspan="4" col="6">
		                    <field name="model_id" select="1"/>
		                    <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>
    </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="type">search</field>
        <field name="arch" type="xml">
            <search string="Search ProcessNode">
                <group col="10" colspan="4">
                    <field name="name"/>
                    <field name="model_id"/>
                    <field name="kind" />
                </group>
                <newline/>
                <group expand="0" string="Group By..." colspan="4" col="4">
                    <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="type">tree</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="type">form</field>
        <field name="arch" type="xml">
            <form string="Process Transition">
                <group col="6" colspan="4">
                    <field name="name" select="1"/>
                    <field name="source_node_id" select="1"/>
                    <field name="target_node_id" select="1"/>
                </group>
                <notebook colspan="4">
                    <page string="Actions">
                        <field name="action_ids" nolabel="1" colspan="4">
                            <tree string="Actions">
                                <field name="name"/>
                                <field name="state"/>
                                <field name="action"/>
                            </tree>
                            <form string="Actions">
                                <field name="name" colspan="4"/>
                                <newline/>
                                <field name="state"/>
                                <field name="action"/>
                            </form>
                        </field>
                    </page>
                    <page string="Workflow Transitions">
                        <field name="transition_ids" colspan="4" nolabel="1"/>
                    </page>
                    <page string="Associated Groups">
                        <field name="group_ids" colspan="4" nolabel="1"/>
                    </page>
                    <page string="Notes">
                        <field name="note" nolabel="1" colspan="4"/>
                    </page>
                </notebook>
            </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="type">search</field>
        <field name="arch" type="xml">
            <search string="Search Process Transition">
                <group col="10" colspan="4">
                    <field name="name"/>
                    <field name="source_node_id"/>
                    <field name="target_node_id" />
                </group>
<!--
                <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>
