Odoo Help

Welcome!

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.

0

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

By
Kit Sunde
on 8/24/14, 12:36 PM 915 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>

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)

Stats

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