Inheriting Workflows in OpenERP

A workflow needs to be inherited for number of reasons to meet one’s requirement.

Adding a new activity to existing workflow-

<record id=”activity_id” model=”workflow.activity”>
<field name=”wkf_id” ref=”module.workflow_id”/>
<field name=”name”>activity_name</field>


Here Approval activity has been added to sales workflow

<record id=”act_approval” model=”workflow.activity”>
<field name=”wkf_id” ref=”sale.wkf_sale”/>
<field name=”name”>approval</field>
<field name=”kind”>function</field>
<field name=”action”>action_approval()</field>

Modifying an activity of existing workflow-

<record id=”module.activity_id” model=”workflow.activity”>
<field name=”wkf_id” ref=”module.workflow_id”/>
<field name=”name”>activity_name</field>


act_ship activity of sales wokflow is modified to add one more function

<record id=”sale.act_ship” model=”workflow.activity”>
<field name=”wkf_id” ref=”sale.wkf_sale”/>
<field name=”name”>ship</field>
<field name=”kind”>function</field>
<field name=”action”>action_ship_create()

Adding/Modifying transitions in existing workflow-

<record id=”trans_id” model=”workflow.transition”>
<field name=”act_from” ref=”module.act_from_id”/>
<field name=”act_to” ref=”new_act_id”/>


Here, a new transition has been added from draft to approval.

<record id=”trans_act_draft_approval” model=”workflow.transition”>
<field name=”act_from” ref=”sale.act_draft”/>
<field name=”act_to” ref=”act_approval”/>
<field name=”signal”>confirm_approve</field>

For creating new workflow, my suggestion is to start with a simple flow with function defined at each activity. Then, test the flow by checking the right function is getting called. Once the flow is proper you can go ahead and add complex functionality. The reason for this approach is that OpenERP does not throw any exception in case of error.

5 thoughts on “Inheriting Workflows in OpenERP

  1. Hi Aasim, I would like to get your help on a workflow issue I am having,.

    As you know, Openerp 6.1 has got a small document management module. But there is no default workflow.

    What I thought was, I should create a workflow for that module. I created a new module which inherits the document management module. in the new module, I specified the new workflow. But the workflow is working properly.

    Can you tell me how to create workflow using a new module for an existing module..


    1. Hi Vivek,

      As I have mentioned in my post, the trick to inherit is to use the same id and prefix it with module name. Like- .
      The rule is same for activities and transitions. If you still have doubts, you can call me on skype. My id is aasim.ansari

  2. Hi Asim,

    I have added you on skype.

    There is no workflow in document management module of openerp. I am creating workflow for that in my new module that inherits the document management module

    ( note: I only inherit the class and view of existing module, not the workflow. Because there is no workflow for document management module to be inherited.

    I tried to create the workflow using the doc mgt model name as reference. But, that does not seem to be working properly.


  3. Mazhar Iqbal Rana

    How can I have an approval button in purchase order so that phase goes from draft po to approved and then go to rfq sent?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s