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.

1

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

By
Bonnet Denis
on 2/19/13, 10:59 AM 3,124 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?

edit:

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
1

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
0

Yannick Vaucher

--Yannick Vaucher--
1699
| 5 7 9
Lausanne, Switzerland
--Yannick Vaucher--
Yannick Vaucher
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
0
eLBati
On 6/13/13, 11:08 AM

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

See the linked patch

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

1 follower(s)

Stats

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