small change in other Actions in Server Action
authormga@tinyerp.com <>
Thu, 14 Aug 2008 08:40:46 +0000 (14:10 +0530)
committermga@tinyerp.com <>
Thu, 14 Aug 2008 08:40:46 +0000 (14:10 +0530)
bzr revid: mga@tinyerp.com-20080814084046-w8lxbircglwu7ddw

bin/addons/base/ir/ir_actions.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c31b33d..159707c
@@ -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()