diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2008-06-15 00:25:47 +0000 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2008-06-15 00:25:47 +0000 |
| commit | 3fe1d6c9ff43d2a99ed4b3a835663b7230f932a6 (patch) | |
| tree | 0cc2eddd72b586b6373a7e012c799f3b4110fb9d /bin/workflow/wkf_expr.py | |
| parent | 43c5db20d0192afa10d106fd0f57ddc7b87da67b (diff) | |
Lots of modifs
bzr revid: fp@tinyerp.com-f1b00f3bf53ab89508b79dcf313516f3455ed06c
Diffstat (limited to 'bin/workflow/wkf_expr.py')
| -rw-r--r-- | bin/workflow/wkf_expr.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/bin/workflow/wkf_expr.py b/bin/workflow/wkf_expr.py index 833c106d719..aec79f89163 100644 --- a/bin/workflow/wkf_expr.py +++ b/bin/workflow/wkf_expr.py @@ -55,18 +55,19 @@ class Env(dict): self.columns = self.obj._columns.keys() + self.obj._inherit_fields.keys() def __getitem__(self, key): - if (key in self.columns) and (not super(Env, self).__contains__(key)): - res=self.wf_service.execute_cr(self.cr, self.uid, self.model, 'read',\ - self.ids, [key])[0][key] - super(Env, self).__setitem__(key, res) - return res - elif key in dir(self.obj): - return EnvCall(self.wf_service, (self.cr, self.uid, self.model, key,\ - self.ids)) + if (key in self.columns) or (key in dir(self.obj)): + res = self.obj.browse(self.cr, self.uid, self.ids[0]) + return res[key] + #res=self.wf_service.execute_cr(self.cr, self.uid, self.model, 'read',\ + # self.ids, [key])[0][key] + #super(Env, self).__setitem__(key, res) + #return res + #elif key in dir(self.obj): + # return EnvCall(self.wf_service, (self.cr, self.uid, self.model, key,\ + # self.ids)) else: return super(Env, self).__getitem__(key) - def _eval_expr(cr, ident, workitem, action): ret=False for line in action.split('\n'): @@ -83,6 +84,15 @@ def _eval_expr(cr, ident, workitem, action): ret = eval(line, env) return ret +def execute_action(cr, ident, workitem, activity): + print 'Execute Action' + wf_service = netsvc.LocalService("object_proxy") + obj = pooler.get_pool(cr.dbname).get('ir.actions.server') + ctx = {'active_id':ident[2], 'active_ids':[ident[2]]} + result = obj.run(cr, ident[0], [activity['action_id']], ctx) + print 'Result', result + return result + def execute(cr, ident, workitem, activity): return _eval_expr(cr, ident, workitem, activity['action']) |
