OpenERP XML RPC error: 'sale_order' object has no attribute 'order_confirm'
I'm trying to confirm a sale order via xml rpc with java.
My code is
Log.i(MY_DEBUG_TAG, "XML RPC Confirming the sale order "+saleOrder.getId());
rpcResult = rpcClient.call("execute", DB_NAME, 1, PASSWORD, "sale.order", "order_confirm", saleOrder.getId());
Log.i(MY_DEBUG_TAG, "XML RPC RESULT = "+rpcResult.toString());
And the curreponding error message says:
[2011-09-05 10:49:56,139][?] DEBUG_RPC:service:'object'
[2011-09-05 10:49:56,139][?] DEBUG_RPC:method:u'execute'
[2011-09-05 10:49:56,139][?] DEBUG_RPC:params:['itflux_demo', 1, '*', 'sale.order', 'order_confirm', 137]
[2011-09-05 10:49:56,140][itflux_demo] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
AttributeError: 'sale_order' object has no attribute 'order_confirm'
[2011-09-05 10:49:56,140][itflux_demo] DEBUG_RPC:exception:u"'sale_order' object has no attribute 'order_confirm'"
[2011-09-05 10:49:56,140][itflux_demo] DEBUG_RPC:xmlrpc:"POST /object H开发者_JAVA百科TTP/1.1" 200 -
and the record's state is still draft
.
When I tried to confirrm the same via gtk client, it found no issues and the corresponding log shows:
[2011-09-05 10:20:31,138][?] DEBUG_RPC:params:['itflux_demo', 1, '*', 'sale.order', 'order_confirm', 137]
and the record's state changed from draft
to manual
.
What is wrong with my code?
Try to use this :
def exec_workflow(self, db, uid, passwd, object, method, id)
instead of :
def execute(self, db, uid, passwd, object, method, *args)
So, it will be I guess :
rpcResult = rpcClient.call("exec_workflow", DB_NAME, 1, PASSWORD, "sale.order", "order_confirm", saleOrder.getId());
精彩评论