Odoo Help


how can a base.action.rule be run just one time?

Bonnet Denis
on 2/19/13, 10:59 AM 4,361 views

I want to create a base.action.rule object, call at the creation date. But I don't find any filter to stop the action rule after only one call. How can I stop it or What can I use to do this instead of action.rule?


In base.action.rule source code I found this :

def _check(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
        """ This Function is called by scheduler. """
        context = context or {}
        # retrieve all the action rules that have a trg_date_id and no precondition

and this :

def _register_hook(self, cr, ids=None):
    """ Wrap the methods `create` and `write` of the models specified by
        the rules given by `ids` (or all existing rules if `ids` is `None`.)

But register hook is called even if an action as a trigger date attribute? I don't understand this. If someone can explain.

Which version are you using?

Camptocamp SA
on 2/20/13, 6:00 AM

I use the openERP v7

Bonnet Denis
on 2/20/13, 7:24 AM

indeed, it seems we missed that point when designing the new base action rules... :-(

In the trunk we will fix by adding new options that will be dedicated to this kind of use case, but in the meanwhile you can use the following workaround:

  • put a condition that does not check the create date at all (should check every other conditino though)
  • as action, put an server action that looks like this: does something only if the create_date is less than 2 seconds ago. Otherwise, do nothing..

thanks a lot.

Bonnet Denis
on 2/20/13, 9:18 AM

I can't use object.create_date or object.write_date in the condition of the action. I get: AttributeError: "Field 'create_date' does not exist in object [...]"

Maxime Chambreuil
on 1/31/15, 10:11 AM
On 6/13/13, 11:08 AM

I think it's the problem described in bug 1190592.

See the linked patch


Yannick Vaucher - Camptocamp

--Yannick Vaucher - Camptocamp--

| 5 7 9
Lausanne, Switzerland
--Yannick Vaucher - Camptocamp--
Yannick Vaucher - Camptocamp
On 2/19/13, 1:20 PM

As an object will only have a single create_date, I don't see where is the issue.

It will be called once for each created object.

Am I missing something?

In base.action.rule form I want to send an e-mail and I set the field trg_date_id to project.task.work.date and the base.action.rule cron run every minutes(for the test) and every minutes all work objects are check and send me a mail. It's like he didn't use the date field.

Bonnet Denis
on 2/20/13, 4:52 AM

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

1 follower(s)


Asked: 2/19/13, 10:59 AM
Seen: 4361 times
Last updated: 3/16/15, 8:10 AM