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

    <menuitem
        id="menu_process"
        name="Enterprise Processes"
        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="type">form</field>
        <field name="arch" type="xml">
            <form string="Process">
                <group colspan="4" string="Details">
                    <field name="name" select="1"/>
                    <field name="active" select="2"/>
                    <field name="model_id" select="1"/>
                </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" string="Details">
                                    <field name="name" select="1"/>
                                    <field name="flow_start"/>
                                    <field name="process_id" readonly="1" required="0"/> <!-- used by transition_out -->
                                    <newline/>
                                    <field name="model_id" select="1"/>
                                    <field name="menu_id" select="2"/>                                    
                                    <newline/>
                                    <field name="kind" select="1"/>
                                    <field name="help_url" widget="url"/>
                                    <field name="model_states"/>
                                    <field name="subflow_id" domain="[('name', '!=', parent.name)]" attrs="{'readonly':[('kind','=','state')]}"/>
                                </group>
                                <notebook colspan="4">
                                    <page string="Outgoing Transitions">
                                        <field name="transition_out" colspan="4" nolabel="1">
                                            <tree string="Transitions">
                                                <field name="name"/>
                                                <field name="target_node_id"/>
                                            </tree>
                                            <form string="Transition">
                                                <group colspan="4" string="Details">
                                                    <field name="name"/>
                                                    <newline/>
                                                    <field name="target_node_id" domain="[('process_id', '=', parent.process_id)]"/>
                                                </group>
                                                <notebook colspan="4">
                                                    <page string="Buttons">
                                                        <field name="action_ids" colspan="4" nolabel="1">
                                                            <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="Roles Required">
                                                        <field name="role_ids" colspan="4" nolabel="1"/>
                                                    </page>
                                                    <page string="Roles from Workflow">
                                                        <field name="transition_ids" colspan="4" nolabel="1"/>
                                                    </page>
                                                    <page string="Extra Information">
                                                        <field name="note" colspan="4" nolabel="1"/>
                                                    </page>
                                                </notebook>
                                            </form>
                                        </field>
                                    </page>
                                    <page string="Conditions">
                                        <field name="condition_ids" nolabel="1" colspan="4">
                                            <tree string="Conditions">
                                                <field name="name"/>
                                                <field name="model_id"/>
                                                <field name="model_states"/>
                                            </tree>
                                            <form string="Condition">
                                                <field name="name"/>
                                                <field name="model_id"/>
                                                <newline/>
                                                <field name="model_states" colspan="4"/>
                                            </form>
                                        </field>
                                    </page>
                                    <page string="Extra Information">
                                        <field name="note" nolabel="1" colspan="4"/>
                                    </page>
                                </notebook>
                            </form>
                        </field>
                    </page>
                    <page string="Extra Information">
                        <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 model="ir.actions.act_window" id="action_process_form">
        <field name="name">Process</field>
        <field name="res_model">process.process</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </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" string="Details">
                    <field name="name" select="1"/>
                    <field name="flow_start"/>                                    
                    <field name="process_id"/>
                    <newline/>                                    
                    <field name="model_id" select="1"/>
                    <field name="menu_id" select="2"/>                                    
                    <newline/>
                    <field name="kind" select="1"/>
                    <field name="help_url" widget="url"/>
                    <field name="model_states"/>
                    <field name="subflow_id" attrs="{'readonly':[('kind','=','state')]}"/>
                </group>
                <notebook colspan="4">
                    <page string="Outgoing Transitions">
                        <field name="transition_out" colspan="4" nolabel="1">
                            <tree string="Transitions">
                                <field name="name"/>
                                <field name="target_node_id"/>
                            </tree>
                            <form string="Transition">
                                <group colspan="4" string="Details">
                                    <field name="name"/>
                                    <newline/>
                                    <field name="target_node_id" domain="[('process_id', '=', parent.process_id)]"/>
                                </group>
                                <notebook colspan="4">
                                    <page string="Buttons">
                                        <field name="action_ids" colspan="4" nolabel="1">
                                            <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="Roles Required">
                                        <field name="role_ids" colspan="4" nolabel="1"/>
                                    </page>
                                    <page string="Roles from Workflow">
                                        <field name="transition_ids" colspan="4" nolabel="1"/>
                                    </page>
                                    <page string="Extra Information">
                                        <field name="note" colspan="4" nolabel="1"/>
                                    </page>
                                </notebook>
                            </form>
                        </field>
                    </page>
                    <page string="Conditions">
                        <field name="condition_ids" nolabel="1" colspan="4">
                            <tree string="Conditions">
                                <field name="name"/>
                                <field name="model_id"/>
                                <field name="model_states"/>
                            </tree>
                            <form string="Condition">
                                <field name="name"/>
                                <field name="model_id"/>
                                <newline/>
                                <field name="model_states" colspan="4"/>
                            </form>
                        </field>
                    </page>
                    <page string="Extra Information">
                        <field name="note" nolabel="1" colspan="4"/>
                    </page>
                </notebook>
            </form>                                
        </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>
    </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 string="Details">
                    <field name="name" select="1"/>
                    <newline/>
                    <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="Roles Required">
                        <field name="role_ids" colspan="4" nolabel="1"/>
                    </page>
                    <page string="Roles from Workflow">
                        <field name="transition_ids" colspan="4" nolabel="1"/>
                    </page>
                    <page string="Notes">
                        <field name="note" nolabel="1" colspan="4"/>
                    </page>
                </notebook>
            </form>
        </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>
    </record>
    <menuitem
        id="menu_process_transition_form"
        action="action_process_transition_form"
        parent="menu_process"/>

</data>
</openerp>
