diff options
| author | Christophe Simonis <christophe@cobalt> | 2009-01-03 00:18:51 +0100 |
|---|---|---|
| committer | Christophe Simonis <christophe@cobalt> | 2009-01-03 00:18:51 +0100 |
| commit | 5ff3af95e26ed8c761e41d0ac4bec17bde2c81a9 (patch) | |
| tree | 5a020f69a786ef6fa6ac4e18348a714efc27bfb7 /bin/workflow/wkf_expr.py | |
| parent | ff34cfcb3da7822ea55497cd52f579a7a7ef9de0 (diff) | |
[IMP] use the pooler directly instead of the 'object_proxy'
[IMP] wkf_expr: remove dead code
bzr revid: christophe@cobalt-20090102231851-zzobv5dx3pplh265
Diffstat (limited to 'bin/workflow/wkf_expr.py')
| -rw-r--r-- | bin/workflow/wkf_expr.py | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/bin/workflow/wkf_expr.py b/bin/workflow/wkf_expr.py index fff74884e3f..dee4167bf48 100644 --- a/bin/workflow/wkf_expr.py +++ b/bin/workflow/wkf_expr.py @@ -25,22 +25,8 @@ import netsvc import osv as base import pooler - -class EnvCall(object): - - def __init__(self,wf_service,d_arg): - self.wf_service=wf_service - self.d_arg=d_arg - - def __call__(self,*args): - arg=self.d_arg+args - return self.wf_service.execute_cr(*arg) - - class Env(dict): - - def __init__(self, wf_service, cr, uid, model, ids): - self.wf_service = wf_service + def __init__(self, cr, uid, model, ids): self.cr = cr self.uid = uid self.model = model @@ -52,13 +38,6 @@ class Env(dict): 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) @@ -75,13 +54,11 @@ def _eval_expr(cr, ident, workitem, action): elif line =='False': ret=False else: - wf_service = netsvc.LocalService("object_proxy") - env = Env(wf_service, cr, uid, model, ids) + env = Env(cr, uid, model, ids) ret = eval(line, env) return ret def execute_action(cr, ident, workitem, activity): - 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) @@ -97,9 +74,9 @@ def check(cr, workitem, ident, transition, signal): uid = ident[0] if transition['role_id'] and uid != 1: - serv = netsvc.LocalService('object_proxy') - user_roles = serv.execute_cr(cr, uid, 'res.users', 'read', [uid], ['roles_id'])[0]['roles_id'] - ok = ok and serv.execute_cr(cr, uid, 'res.roles', 'check', user_roles, transition['role_id']) + pool = pooler.get_pool(cr.dbname) + user_roles = pool.get('res.users').read(cr, uid, [uid], ['roles_id'])[0]['roles_id'] + ok = ok and pool.get('res.roles').check(cr, uid, user_roles, transition['role_id']) ok = ok and _eval_expr(cr, ident, workitem, transition['condition']) return ok |
