This question has been flagged
3 Replies
9689 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.

Avatar
Discard

Which version are you using?

Author

I use the openERP v7

Best Answer

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..
Avatar
Discard
Author

thanks a lot.

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 [...]"

Best Answer

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?

Avatar
Discard
Author

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.

Best Answer

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

See the linked patch

Avatar
Discard