[imp] added service in object_service to be able to call a method specifying kwargs

bzr revid: nicolas.vanhoren@openerp.com-20120105160351-0xy697sjeihplx6v
This commit is contained in:
niv-openerp 2012-01-05 17:03:51 +01:00
parent e80526282c
commit 4d3387c54c
2 changed files with 6 additions and 1 deletions

View File

@ -162,6 +162,11 @@ class object_proxy(object):
raise except_osv('Object Error', 'Object %s doesn\'t exist' % str(obj))
return getattr(object, method)(cr, uid, *args, **kw)
def execute_kw(self, db, uid, obj, method, args, kw=None):
import pdb
pdb.set_trace()
return self.execute(db, uid, obj, method, *args, **kw or {})
@check
def execute(self, db, uid, obj, method, *args, **kw):
cr = pooler.get_db(db).cursor()

View File

@ -572,7 +572,7 @@ class objects_proxy(netsvc.ExportService):
params = params[3:]
if method == 'obj_list':
raise NameError("obj_list has been discontinued via RPC as of 6.0, please query ir.model directly!")
if method not in ['execute','exec_workflow']:
if method not in ['execute', 'execute_kw', 'exec_workflow']:
raise NameError("Method not available %s" % method)
security.check(db,uid,passwd)
assert openerp.osv.osv.service, "The object_proxy class must be started with start_object_proxy."