Merge lp:~camptocamp/openobject-addons/7.0-fix_action_rule_processing_lp1190592-afe into lp:openobject-addons/7.0

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix_action_rule_processing_lp1190592-afe
Merge into: lp:openobject-addons/7.0
Diff against target: 17 lines (+6/-1)
1 file modified
base_action_rule/base_action_rule.py (+6/-1)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix_action_rule_processing_lp1190592-afe
Reviewer Review Type Date Requested Status
Leonardo Pistone (community) code review Approve
OpenERP Core Team Pending
Review via email: mp+209077@code.launchpad.net

Description of the change

Fix base.action.rule is repeated ignoring the date it was last run (lp:1190592)

I think this fix is more readable than the version proposed in https://code.launchpad.net/~elbati/openobject-addons/7.0_fix_action_rule_processing/+merge/169191

To post a comment you must log in.
Revision history for this message
Leonardo Pistone (lepistone) wrote :

Thanks Alexandre,

I completely agree with you the original one-liner is unreadable (I remember spending a while to figure it out at the time).

The reason for the old proposal was to just fix the bug, without trying to improve the code.

So if it were new code, I'd be 100% approve, for a fix like that I don't know.

review: Abstain (code review)
Revision history for this message
Leonardo Pistone (lepistone) wrote :

...but your fix is good so no reason to block this. Thanks!

review: Approve (code review)

Unmerged revisions

9860. By Alexandre Fayolle - camptocamp

[FIX] base.action.rule is repeated ignoring the date it was last run

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 14:40:55 +0000
@@ -266,7 +266,12 @@
266 if not record_dt:266 if not record_dt:
267 continue267 continue
268 action_dt = get_datetime(record_dt) + delay268 action_dt = get_datetime(record_dt) + delay
269 if last_run and (last_run <= action_dt < now) or (action_dt < now):269 if last_run: # don't try to put everything in a one-liner or
270 # risk being bitten by lp:1190592
271 needs_process = (last_run <= action_dt < now)
272 else:
273 needs_process = (action_dt < now)
274 if needs_process:
270 try:275 try:
271 self._process(cr, uid, action, [record.id], context=context)276 self._process(cr, uid, action, [record.id], context=context)
272 except Exception:277 except Exception: