openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #09051
[Bug 933569] Re: "Creation date" Action Rules incorrectly fired when changing State
(typo fix)
** Description changed:
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, sya , from draft to open. The same "creation date" rule will be fired incorrecly, for example, sending a new "created issue" email.
-
+ 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
+ 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
--
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):
New
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