← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/ocb-addons/ocb-7.0-fix_action_rule_processing_lp1190592-afe into lp:ocb-addons

 

Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/ocb-addons/ocb-7.0-fix_action_rule_processing_lp1190592-afe into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1190592 in OpenERP Community Backports (Addons): "base.action.rule is repeated ignoring the date it was last run"
  https://bugs.launchpad.net/ocb-addons/+bug/1190592

For more details, see:
https://code.launchpad.net/~camptocamp/ocb-addons/ocb-7.0-fix_action_rule_processing_lp1190592-afe/+merge/209086

fix issue with action being erroneously repeated. 

Port of https://code.launchpad.net/~camptocamp/openobject-addons/7.0-fix_action_rule_processing_lp1190592-afe/+merge/209077 

Note that there is another MP on openobject-addons for this bug, which I personnaly find less clear (https://code.launchpad.net/~elbati/openobject-addons/7.0_fix_action_rule_processing/+merge/169191). If people think that the latter is better, just say so in the reviews and I'll update the ocb MP accordingly. 
-- 
https://code.launchpad.net/~camptocamp/ocb-addons/ocb-7.0-fix_action_rule_processing_lp1190592-afe/+merge/209086
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~camptocamp/ocb-addons/ocb-7.0-fix_action_rule_processing_lp1190592-afe into lp:ocb-addons.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py	2014-02-12 11:39:24 +0000
+++ base_action_rule/base_action_rule.py	2014-03-03 15:24:04 +0000
@@ -266,7 +266,12 @@
                 if not record_dt:
                     continue
                 action_dt = get_datetime(record_dt) + delay
-                if last_run and (last_run <= action_dt < now) or (action_dt < now):
+                if last_run: # don't try to put everything in a one-liner or
+                             # risk being bitten by lp:1190592
+                    needs_process = (last_run <= action_dt < now)
+                else:
+                    needs_process = (action_dt < now)
+                if needs_process:
                     try:
                         self._process(cr, uid, action, [record.id], context=context)
                     except Exception:


Follow ups