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

Bug #1190592 reported by Leonardo Pistone
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 1
OpenERP Community Backports (Addons)
Status tracked in 7.0
7.0
New
Undecided
Unassigned

Bug Description

This is related to:
http://help.openerp.com/question/2303/how-can-a-baseactionrule-be-run-just-one-time/

If you look at the code here:
http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/base_action_rule/base_action_rule.py#L272

                if last_run and (last_run <= action_dt < now) or (action_dt < now):

you see a misuse of the python and-or trick. What happens in that specific case is that when (last_run <= action_dt < now) is False, then Python checks (action_dt < now) which can easily be True.

I think this can be fixed using the inline if-else instead of the and-or trick.

The bug seems to have been introduced just before releasing 7.0:
http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/revision/8098.3.29

Thanks!

Related branches

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.