I have extended model stock.picking
with a new method called do_new_transfer_xmlrpc
which enables a basic new_transfer from XMLRPC.
class Picking(models.Model):
_inherit = 'stock.picking'
@api.multi
def do_new_transfer_xmlrpc(self):
print 'DEBUG'
self.do_transfer()
return ['OK', '']
I try to call that method using:
api.execute_kw(db, uid, pwd, 'stock.picking', 'do_new_transfer_xmlrpc', [[int(picking_id)], {}])
But I get:
Fault: <Fault 1: 'Traceback (most recent call last):\n File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 56, in xmlrpc_return\n result = odoo.http.dispatch_rpc(service, method, params)\n File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 118, in dispatch_rpc\n result = dispatch(method, params)\n File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 38, in dispatch\n res = fn(db, uid, *params)\n File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 157, in execute_kw\n return execute(db, uid, obj, method, *args, **kw or {})\n File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper\n return f(dbname, *args, **kwargs)\n File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 164, in execute\n res = execute_cr(cr, uid, obj, method, *args, **kw)\n File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 153, in execute_cr\n return odoo.api.call_kw(recs, method, args, kw)\n File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 685, in call_kw\n method = getattr(type(model), name)\nAttributeError: type object \'stock.picking\' has no attribute \'do_new_transfer_xmlrpc\'\n'>
Is the used call method properly written?
This is the right syntax:
api.execute_kw(db, uid, pwd, 'stock.picking', 'do_new_transfer_xmlrpc', [int(picking_id)])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With