small change in other Actions in Server Action

bzr revid: mga@tinyerp.com-20080814084046-w8lxbircglwu7ddw
This commit is contained in:
mga@tinyerp.com 2008-08-14 14:10:46 +05:30
parent a2772da7ef
commit ec63f82ad1
1 changed files with 26 additions and 4 deletions

30
bin/addons/base/ir/ir_actions.py Normal file → Executable file
View File

@ -352,17 +352,39 @@ class actions_server(osv.osv):
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (action.address))
else:
logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (action.address))
if action.state == 'trigger':
#wf_service = netsvc.LocalService("workflow")
print action.trigger_obj_id
#wf_service.trg_validate(uid, )
wf_service = netsvc.LocalService("workflow")
res = str(action.trigger_obj_id).split(',')
model = res[0]
id = res[1]
wf_service.trg_validate(uid, model, int(id), action.trigger_name, cr)
if action.state == 'sms':
if tools.sms_send(user, password, api_id, text, to) == True:
logger.notifyChannel('sms', netsvc.LOG_INFO, 'SMS successfully send to : %s' % (action.address))
else:
logger.notifyChannel('sms', netsvc.LOG_ERROR, 'Failed to send SMS to : %s' % (action.address))
if action.state == 'other':
print 'Actions to be Execute', action.child_ids
localdict = {
'self': self.pool.get(action.model_id.model),
'context': context,
'time': time,
'ids': ids,
'cr': cr,
'uid': uid
}
for act in action.child_ids:
code = """
action = {
'res_model': %s,
'type': %s,
'name': %s,
'usage': %s,
}
""" % (action.model_id.model, act.type, act.name, act.usage)
exec action.code in localdict
return False
actions_server()