openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #14241
[Bug 944197] Re: Action Rules don't work right after server is started
The above branch doesn't fix the issue.
The problem is that Rules are only "registered" the first time the the scheduler action runs, which by 6.1 defaults happens at 1 hour intervals.
A workaround might be to reduce interval for the "Check Action Rules" scheduled action (say, every 5mn).
The solution should be the server to register the action rules as soon as it finishes loading modules.
The closes thing I came up is implemented a workaround as part a Action Rule Triggers module: http://apps.openerp.com/addon/7738.
In base_action_rule.py, the users.login() is extended to force Rules be registered as soon as a user logins:
#Force register hooks on user Login, to not depend on scheduler
#BUG https://bugs.launchpad.net/openobject-addons/+bug/944197
class users(osv.osv):
_inherit = "res.users"
def login(self, db, login, password):
#Perform login
user_id = super(users, self).login(db, login, password)
#Register hooks
cr = pooler.get_db(db).cursor()
rule_pool = pooler.get_pool(db).get('base.action.rule')
rule_ids = rule_pool.search(cr, 1, [])
rule_pool._register_hook(cr, 1, rule_ids)
rule_ids = None
cr.close()
#End
return user_id
users()
--
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/944197
Title:
Action Rules don't work right after server is started
Status in OpenERP Addons (modules):
Confirmed
Bug description:
Automated Actions that are run on write will only run after the
scheduled "Check actions" runs for the first time.
To repeat:
- Create an automated action, with no conditions (it will fire on every save)
- Save and test it: it will run correctly.
- Restart the server and test it again immediatly after it's available: nothhing will happen (!)
- Wait until the scheduler runs "Check Action Rules" and then test again: now it will work correctly.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/944197/+subscriptions
References