Odoo Help

0

My ir.actions.server isn't being triggered on sales order save, why?

By
Kit Sunde
on 8/24/14, 12:36 PM 1,153 views

I'm trying to get a basic action triggered when I save the sales order. I've tried buttin print statements and even just plain exit() in the code block, but neither seem to be getting called. I've restarted the server, upgraded the module and the XML is being loaded. This is what I have:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="ir_actions_server_schedule_emails" model="ir.actions.server">
            <field name="state">code</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="code">exit()</field>
            <field name="type">ir.actions.server</field>
            <field name="state">code</field>
            <field name="condition">True</field>
            <field name="name">Schedule Emails</field>
        </record>
    </data>
</openerp>

Why is it not triggering?

 

0
Kit Sunde
On 8/24/14, 3:08 PM

ir.actions.server just defines an action to be taken, but it doesn't inherently have any triggers for that action. To trigger ir.actions.server on a modal update add a base.action.rule record. Use something like this:

<record id="rule_trigger_email_schedule" model="base.action.rule">
  <field name="name">Trigger email scheduling.</field>
  <field name="model_id" ref="sale.model_sale_order" />
  <field name="kind">on_create_or_write</field>
  <field name="server_action_ids" eval="[(6,0,[ref('ir_actions_server_schedule_emails')])]" />
</record>

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.

Register

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)

Stats

Asked: 8/24/14, 12:36 PM
Seen: 1153 times
Last updated: 3/16/15, 8:10 AM