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

    <!--
        Process Node
    -->

        <record id="process_node_procuretasktask0" model="process.node">
            <field name="menu_id" ref="project.menu_action_view_task"/>
            <field name="model_id" ref="project.model_project_task"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;For each product, on type service and on order&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="sale.process_process_salesprocess0"/>
            <field name="subflow_id" ref="project.process_process_tasksprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='draft'&quot;&quot;&quot;" name="model_states"/>
            <field eval="0" name="flow_start"/>
        </record>

        <record id="process_node_saleordertask0" model="process.node">
            <field name="menu_id" ref="sale.menu_sale_order"/>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Sales Order Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;In case you sell services on sales order&quot;&quot;&quot;" name="note"/>
            <field name="subflow_id" ref="sale.process_process_salesprocess0"/>
            <field name="process_id" ref="project.process_process_tasksprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='draft'&quot;&quot;&quot;" name="model_states"/>
            <field eval="1" name="flow_start"/>
        </record>

        <record id="process_node_mrptask0" model="process.node">
            <field name="menu_id" ref="project.menu_action_view_task"/>
            <field name="model_id" ref="project.model_project_task"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;A task is created to provide the service.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="procurement.process_process_serviceproductprocess0"/>
            <field name="subflow_id" ref="project.process_process_tasksprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='draft'&quot;&quot;&quot;" name="model_states"/>
            <field eval="0" name="flow_start"/>
        </record>

    <!--
        Process Transition
    -->

        <!-- This process node is duplicated here from the corresponding sale_stock node because
             `project_mrp` implements a basic procurement system for services without actually using the
             full-fledged procurement process from sale_stock, and without the dependency. So it still
             represents a "procurement system". Sharing the external ID causes other problems, so
             we duplicate it instead.
             TODO: To cleanup this duplicate node, it should probably be moved to the
             `sale` module directly, and removed from both `sale_stock` and `project_mrp`.
        --> 
        <record id="process_node_saleprocurement0" model="process.node">
            <field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
            <field name="model_id" ref="procurement.model_procurement_order"/>
            <field name="kind">subflow</field>
            <field name="name">Procurement</field>
            <field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
            <field name="process_id" ref="sale.process_process_salesprocess0"/>
            <field name="model_states">object.state=='confirmed'</field>
            <field name="flow_start" eval="1"/>
        </record>
        <record id="process_transition_procuretask0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Procurement Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;if product type is 'service' then it creates the task.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_procuretasktask0"/>
            <field model="process.node" name="source_node_id" ref="process_node_saleprocurement0"/>
        </record>

        <record id="process_transition_createtask0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Create Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Product type is service, then its creates the task.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="project.process_node_drafttask0"/>
            <field model="process.node" name="source_node_id" ref="process_node_saleordertask0"/>
        </record>

        <record id="process_transition_ordertask0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Order Task&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;If procurement method is Make to order and supply method is produce&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_mrptask0"/>
            <field model="process.node" name="source_node_id" ref="procurement.process_node_serviceonorder0"/>
        </record>

    </data>
</openerp>
