How to replace existing workflow (activity and transition) using import method

Asked by John Chen

Hi

i would like to replace existing workflow like activity and transistion in administration - > customization - > workflows

i use this kind of code to import it
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="act_confirmed" model="workflow.activity">
            <field name="wkf_id" ref="purchase_order"/>
            <field name="name">confirmed</field>
            <field name="kind">function</field>
            <field name="action">wkf_confirm_order()</field>
        </record>
        <record id="act_waitingapproval" model="workflow.activity">
            <field name="wkf_id" ref="purchase_order"/>
            <field name="name">waitingapproval</field>
            <field name="kind">function</field>
            <field name="action">wkf_waitingapproval()</field>
        </record>
        <record id="act_waitingmaterialsupervisor" model="workflow.activity">
            <field name="wkf_id" ref="purchase_order"/>
            <field name="name">waitingmaterialsupervisor</field>
            <field name="kind">function</field>
            <field name="action">write({'state':'confirmed'})</field>
        </record>
        <record id="trans_waitingmaterialsupervisor_confirmed" model="workflow.transition">
            <field name="act_from" ref="act_waitingmaterialsupervisor"/>
            <field name="act_to" ref="act_confirmed"/>
            <field name="signal">purchase_approve</field>
        </record>
        <record id="trans_waitingapproval_confirmed" model="workflow.transition">
            <field name="act_from" ref="act_waitingapproval"/>
            <field name="act_to" ref="act_confirmed"/>
            <field name="signal">purchase_approve_direct_supervisor</field>
        </record>
        <record id="trans_waitingapproval_waitingmaterialsupervisor_confirmed" model="workflow.transition">
            <field name="act_from" ref="act_waitingapproval"/>
            <field name="act_to" ref="act_waitingmaterialsupervisor"/>
            <field name="signal">purchase_approve_material_supervisor</field>
        </record>
    </data>
</openerp>

but there is one thing that is weird here, id="act_confirmed" is an existing "activity".
If i don't place it in here, when i importing, it will command an error that said couldn't find act_confirmed, therefore i added here.

but if i added here, when i import the module to OpenERP, the activity will be duplicated, and the workflow will also be messed up. I don't want it to be duplicated.

Anyone have clue about this? how to replace it? or what solution best for this. Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#1

Hi John,

the XML ids are relative to the module. You can refer to the original activity with "purchase.act_confirmed".

Cheers,
Stefan.

Revision history for this message
John Chen (john-chen2011) said :
#2

Hi Stefan

i tried changing ref="act_confirmed" to ref="purchase.act_confirmed"

and i imported it shows this error

ValueError: No references to purchase.act_confirmed

Thanks Stefan for your time and guidance :D

Cheers,
John

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#3

Hi John,

You need to modify the references to the workflow id as well. Hopefully that solves your problem.

Cheers,
Stefan.

Can you help with this problem?

Provide an answer of your own, or ask John Chen for more information if necessary.

To post a message you must log in.