← Back to team overview

openerp-india team mailing list archive

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

 

Hello Daniel Reis,

I have checked your issue with latest updated code of 6.1 and applied same scenario as you said in issue.
I have created action rule on creation date and created one issue and save it and wait some time but rule not active at my end(based on creation date). Would you please try one's again and informed us still you have faced the same problem and  give related steps with video what you did  at your end.

Thanks and waiting for your reply.

** Changed in: openobject-addons
       Status: New => Incomplete

-- 
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