Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How can I react to a workflow transition?

Kit Sunde
on 8/25/14, 1:31 AM 602 views

I've setup a ir.server.action that reacts to when the model is saved and is in a manual state. However repeated saves will repeatedly trigger the action, so I have to lock on the database. How can I react to the order being confirmed in the workflow instead?

<record id="filter_order_confirm" model="ir.filters">
    <field name="name">By Confirmed Orders</field>
    <field name="model_id">sale.order</field>
    <field name="domain">[('state','=','manual')]</field>

<record id="action_schedule_emails" model="ir.actions.server">
    <field name="state">code</field>
    <field name="model_id" ref="sale.model_sale_order"/>
    <field name="code">object.schedule_emails()</field>
    <field name="type">ir.actions.server</field>
    <field name="condition">True</field>
    <field name="name">Schedule Emails</field>

<record id="rule_trigger_email_scheduling" model="base.action.rule">
    <field name="name">Trigger email scheduling when Order is set to confirm.</field>
    <field name="model_id" ref="sale.model_sale_order" />
    <field name="kind">on_create_or_write</field>
    <field name="filter_id" ref="filter_order_confirm" />
    <field name="server_action_ids" eval="[(6,0,[ref('action_schedule_emails')])]" />

Kit Sunde
On 9/12/14, 5:33 AM

In my case it was enough to do this:

<record id="sale.act_router" model="workflow.activity"> 
  <field name="action_id" ref="action_schedule_emails"/>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 8/25/14, 1:31 AM
Seen: 602 times
Last updated: 3/16/15, 8:10 AM