Odoo Help


How can I react to a workflow transition?

Kit Sunde
on 8/25/14, 1:31 AM 972 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"/>

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


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