Search code examples
xmlodooopenerp-7

How to add action inheriting a workflow in openerp?


I need to add an action in the account_voucher workflow

    <record id="act_done" model="workflow.activity">
        <field name="wkf_id" ref="wkf"/>
        <field name="name">done</field>
        <field name="action">proforma_voucher()</field>
        <field name="kind">function</field>
        <field name="flow_stop">True</field>
    </record>

The action is "reference_action()", but i dont know how to do it. I tried whit this

    <record id="act_reference_done" model="workflow.activity">
        <field name="wkf_id" ref="account_voucher.act_done"/>
        <field name="action">reference_action()</field>
    </record> 

Thing is that i have to put the column "name" or i violate a not-null constraint, but if i do that i just add another activity with the same name and i dont over-ride the other one.

Any tip on how to correct inherit and edit a workflow?

Thanks!


Solution

  • You are doing wrong to override/inherit workflow activity. To override workflow activity, you have to use same xml id with module name where it is created.

    Try this:

    <record id="module_name.act_done" model="workflow.activity">
        <field name="wkf_id" ref="module_name.wkf"/>
        <field name="name">done</field>
        <field name="action">proforma_voucher()
        reference_action()
        </field>
        <field name="kind">function</field>
        <field name="flow_stop">True</field>
    </record>