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

        <!--
            Process
        -->

        <record id="process_process_purchaseprocess0" model="process.process">
            <field eval="1" name="active"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;Purchase&quot;&quot;&quot;" name="name"/>
        </record>

        <!--
            Process Node
        -->

        <record id="process_node_packinginvoice0" model="process.node">
            <field name="model_id" ref="stock.model_stock_picking"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Outgoing Products&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Outgoing products to invoice&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="account.process_process_invoiceprocess0"/>
            <field eval="&quot;&quot;&quot;object.state in ('assigned', 'confirmed')&quot;&quot;&quot;" name="model_states"/>
            <field eval="1" name="flow_start"/>
        </record>

        <record id="process_node_purchaseorder0" model="process.node">
            <field name="menu_id" ref="purchase.menu_purchase_form_action"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Purchase Order&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Confirmed purchase order to invoice&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="account.process_process_supplierinvoiceprocess0"/>
            <field name="subflow_id" ref="process_process_purchaseprocess0"/>
            <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_draftpurchaseorder0" model="process.node">
            <field name="menu_id" ref="purchase.menu_purchase_form_action"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;RFQ&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Request for Quotations.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <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_draftpurchaseorder1" model="process.node">
            <field name="menu_id" ref="purchase.menu_purchase_form_action"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;RFQ&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Request for Quotations.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <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_confirmpurchaseorder0" model="process.node">
            <field name="menu_id" ref="purchase.menu_purchase_form_action"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Confirmed&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;State of the Purchase Order.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='confirmed'&quot;&quot;&quot;" name="model_states"/>
            <field eval="0" name="flow_start"/>
        </record>

        <record id="process_node_approvepurchaseorder0" model="process.node">
            <field name="menu_id" ref="purchase.menu_purchase_form_action"/>
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Approved&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;State of the Purchase Order.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='approved'&quot;&quot;&quot;" name="model_states"/>
            <field eval="0" name="flow_start"/>
        </record>

        <record id="process_node_invoicecontrol0" model="process.node">
            <field name="menu_id" ref="account.menu_action_invoice_tree2"/>
            <field name="model_id" ref="account.model_account_invoice"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Draft Invoice&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;To be reviewed by the accountant.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <field name="subflow_id" ref="account.process_process_supplierinvoiceprocess0"/>
            <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_packinglist0" model="process.node">
            <field name="menu_id" ref="stock.menu_action_picking_tree4"/>
            <field name="model_id" ref="stock.model_stock_picking"/>
            <field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Incoming Products&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;List of ordered products.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <field eval="&quot;&quot;&quot;object.state=='assigned'&quot;&quot;&quot;" name="model_states"/>
            <field eval="0" name="flow_start"/>
        </record>

        <record id="process_node_invoiceafterpacking0" model="process.node">
            <field name="menu_id" ref="account.menu_finance_receivables"/>
            <field name="model_id" ref="account.model_account_invoice"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Draft Invoice&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;To be reviewed by the accountant.&quot;&quot;&quot;" name="note"/>
            <field name="process_id" ref="process_process_purchaseprocess0"/>
            <field name="subflow_id" ref="account.process_process_supplierinvoiceprocess0"/>
            <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_productrecept0" model="process.node">
            <field name="model_id" ref="stock.model_stock_picking"/>
            <field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
            <field eval="&quot;&quot;&quot;Incoming Products&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;Incoming products to control&quot;&quot;&quot;" name="note"/>
            <field name="subflow_id" ref="process_process_purchaseprocess0"/>
            <field name="process_id" ref="account.process_process_supplierinvoiceprocess0"/>
            <field eval="&quot;&quot;&quot;object.state in ('draft', 'open', 'pending', 'close')&quot;&quot;&quot;" name="model_states"/>
            <field eval="1" name="flow_start"/>
        </record>

        <!--
            Process Condition
        -->

        <record id="process_condition_conditionorigin" model="process.condition">
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field name="node_id" ref="process_node_draftpurchaseorder1"/>
            <field eval="&quot;&quot;&quot;object.origin==''&quot;&quot;&quot;" name="model_states"/>
            <field eval="&quot;&quot;&quot;condition_origin&quot;&quot;&quot;" name="name"/>
        </record>

        <record id="process_condition_conditioninvoicemanual" model="process.condition">
            <field name="model_id" ref="purchase.model_purchase_order"/>
            <field name="node_id" ref="process_node_invoicecontrol0"/>
            <field eval="&quot;&quot;&quot;object.invoice_method=='manual'&quot;&quot;&quot;" name="model_states"/>
            <field eval="&quot;&quot;&quot;condition_invoice_manual&quot;&quot;&quot;" name="name"/>
        </record>

        <!--
            Process Transition
        -->

        <record id="process_transition_productrecept0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;From a Pick list&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;A Pick list generates a supplier invoice. Depending on the Invoicing control of the purchase order, the invoice is based on received or on ordered quantities.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="account.process_node_supplierdraftinvoices0"/>
            <field model="process.node" name="source_node_id" ref="process_node_productrecept0"/>
        </record>

        <record id="process_transition_confirmingpurchaseorder0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Confirmation&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;The buyer has to approve the RFQ before being sent to the supplier. The RFQ becomes a confirmed Purchase Order.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_confirmpurchaseorder0"/>
            <field model="process.node" name="source_node_id" ref="process_node_draftpurchaseorder0"/>
            <field eval="[(6,0,[ref('purchase.trans_draft_confirmed')])]" name="transition_ids"/>
        </record>

        <record id="process_transition_confirmingpurchaseorder1" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Confirmation&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;In case there is no supplier for this product, the buyer can fill the form manually and confirm it. The RFQ becomes a confirmed Purchase Order.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_confirmpurchaseorder0"/>
            <field model="process.node" name="source_node_id" ref="process_node_draftpurchaseorder1"/>
        </record>

        <record id="process_transition_approvingpurchaseorder0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Approbation&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;The supplier approves the Purchase Order.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_approvepurchaseorder0"/>
            <field model="process.node" name="source_node_id" ref="process_node_confirmpurchaseorder0" />
        </record>

        <record id="process_transition_invoicefrompurchase0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Invoice&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;The invoice is created automatically if the Invoice control of the purchase order is 'On order'. The invoice can also be generated manually by the accountant (Invoice control = Manual).&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_invoicecontrol0"/>
            <field model="process.node" name="source_node_id" ref="process_node_approvepurchaseorder0"/>
            <field eval="[(6,0,[ref('purchase.trans_router_invoice')])]" name="transition_ids"/>
        </record>

        <record id="process_transition_createpackinglist0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Pick list generated&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;A pick list is generated to track the incoming products.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_packinglist0"/>
            <field model="process.node" name="source_node_id" ref="process_node_approvepurchaseorder0"/>
        </record>

        <record id="process_transition_invoicefrompackinglist0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;Invoice&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;The invoice is created automatically if the Invoice control of the purchase order is 'On picking'. The invoice can also be generated manually by the accountant (Invoice control = Manual).&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="process_node_invoiceafterpacking0"/>
            <field model="process.node" name="source_node_id" ref="process_node_packinglist0"/>
        </record>

        <record id="process_transition_purchaseinvoice0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;From a purchase order&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;A purchase order generates a supplier invoice, as soon as it is confirmed by the buyer. Depending on the Invoicing control of the purchase order, the invoice is based on received or on ordered quantities.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="account.process_node_supplierdraftinvoices0"/>
            <field model="process.node" name="source_node_id" ref="process_node_purchaseorder0"/>
        </record>

        <record id="process_transition_packinginvoice0" model="process.transition">
            <field eval="[(6,0,[])]" name="transition_ids"/>
            <field eval="&quot;&quot;&quot;From a Pick list&quot;&quot;&quot;" name="name"/>
            <field eval="&quot;&quot;&quot;A Pick list generates an invoice. Depending on the Invoicing control of the sale order, the invoice is based on delivered or on ordered quantities.&quot;&quot;&quot;" name="note"/>
            <field model="process.node" name="target_node_id" ref="account.process_node_draftinvoices0"/>
            <field model="process.node" name="source_node_id" ref="process_node_packinginvoice0"/>
        </record>

        <!--
            Process Action
        -->

        <record id="process_transition_action_confirmpurchaseorder0" model="process.transition.action">
            <field eval="&quot;&quot;&quot;wkf_confirm_order&quot;&quot;&quot;" name="action"/>
            <field eval="&quot;&quot;&quot;object&quot;&quot;&quot;" name="state"/>
            <field eval="&quot;&quot;&quot;Confirm&quot;&quot;&quot;" name="name"/>
            <field name="transition_id" ref="process_transition_confirmingpurchaseorder0"/>
        </record>

        <record id="process_transition_action_cancelpurchaseorder0" model="process.transition.action">
            <field eval="&quot;&quot;&quot;write({'state':'cancel'})&quot;&quot;&quot;" name="action"/>
            <field eval="&quot;&quot;&quot;object&quot;&quot;&quot;" name="state"/>
            <field eval="&quot;&quot;&quot;Cancel&quot;&quot;&quot;" name="name"/>
            <field name="transition_id" ref="process_transition_confirmingpurchaseorder0"/>
        </record>

        <record id="process_transition_action_approvingpurchaseorder0" model="process.transition.action">
            <field eval="&quot;&quot;&quot;wkf_approve_order&quot;&quot;&quot;" name="action"/>
            <field eval="&quot;&quot;&quot;object&quot;&quot;&quot;" name="state"/>
            <field eval="&quot;&quot;&quot;Approve&quot;&quot;&quot;" name="name"/>
            <field name="transition_id" ref="process_transition_approvingpurchaseorder0"/>
        </record>

        <record id="process_transition_action_approvingcancelpurchaseorder0" model="process.transition.action">
            <field eval="&quot;&quot;&quot;write({'state':'cancel'})&quot;&quot;&quot;" name="action"/>
            <field eval="&quot;&quot;&quot;object&quot;&quot;&quot;" name="state"/>
            <field eval="&quot;&quot;&quot;Cancel&quot;&quot;&quot;" name="name"/>
            <field name="transition_id" ref="process_transition_approvingpurchaseorder0"/>
        </record>.

        <record id="process_transition_action_invoicefrompurchaseorder0" model="process.transition.action">
            <field eval="&quot;&quot;&quot;action_invoice_create&quot;&quot;&quot;" name="action"/>
            <field eval="&quot;&quot;&quot;object&quot;&quot;&quot;" name="state"/>
            <field eval="&quot;&quot;&quot;Create invoice&quot;&quot;&quot;" name="name"/>
            <field name="transition_id" ref="process_transition_invoicefrompurchase0"/>
        </record>

    </data>
</openerp>
