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 on 2014-03-03

[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
1=== modified file 'base_action_rule/base_action_rule.py'
2--- base_action_rule/base_action_rule.py 2014-02-12 11:39:24 +0000
3+++ base_action_rule/base_action_rule.py 2014-03-03 14:40:55 +0000
4@@ -266,7 +266,12 @@
5 if not record_dt:
6 continue
7 action_dt = get_datetime(record_dt) + delay
8- if last_run and (last_run <= action_dt < now) or (action_dt < now):
9+ if last_run: # don't try to put everything in a one-liner or
10+ # risk being bitten by lp:1190592
11+ needs_process = (last_run <= action_dt < now)
12+ else:
13+ needs_process = (action_dt < now)
14+ if needs_process:
15 try:
16 self._process(cr, uid, action, [record.id], context=context)
17 except Exception: