← Back to team overview

openerp-india team mailing list archive

[Bug 933569] Re: "Creation date" Action Rules incorrectly fired when changing State

 

Hi Vishal,

I noticed that in 6.1 the default interval for the "Check Action Rules"
scheduled action is 1 hour. If you are using this setting, I suggest to
change it to 1 minute. You can confirm if the scheduler ran looking for
it's debug message on the server log.

If you're using an e-mail action, you could be facing another bug 909816.
If date based Action Rules on 6.1-trunk are not working for you at all, then surelly that is the confirmation of a bug.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/933569

Title:
  "Creation date" Action Rules incorrectly fired when changing State

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  To reproduce (6.1 rev 6600):
  1) Create an Action Rule, for object Project Issue, and condition on timing "Creation Date" with zero delay. Set whatever action you like; I suggest sending an email.
  2) Create a Project Issue. Wait for a minute and the next cron will correctly activate the rule.
  3) Now change the issues's state, say , from draft to open. The same "creation date" rule will be fired incorrecly, for example, sending a new "created issue" email.

  I did some digging and can  suggest a solution:
  Conditions on timing should only be activated when running rules from the scheduler,
  This is controlled  in base_action_rule, in the post_action() method.
  However, the crm_case objec's method to change state shorcircuit this by calling directly the base_action_rule._action().

  The solution is to call base_action_rule.post_action() instead.
  Replace crm_case._action() with:

      def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
          context['state_to'] = state_to
          rule_obj = self.pool.get('base.action.rule')
          for case in cases:
              rule_obj.post_action(cr, uid, [case.id], case._name, context=context)
          return True

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/933569/+subscriptions


References