I am struggling to format my call correctly, so that I am able to use the 'write' method, which updates a record.
I have looked at the documentation here, and still cannot work it out. Is there any example where I can have a look at as I could not find any. Here is my code:
$arrayVal1 = array(
new xmlrpcval(1, "int"), //update the linked record
new xmlrpcval(20, "int"), //with id = 20
new xmlrpcval(array(
'answer_id'=>new xmlrpcval(2, "int") //IF Question is a selection
//'answer'=>new xmlrpcval('some_text_here' , "string") //IF Question is a free text
),'struct'));
$cr = 'hr_applicant_question_list_cursor';
$ids= array(new xmlrpcval(1, "int"));
$msg1 = new xmlrpcmsg('execute');
$msg1->addParam(new xmlrpcval($dbname, "string"));
$msg1->addParam(new xmlrpcval($user_id, "int"));
$msg1->addParam(new xmlrpcval($pwd, "string"));
$msg1->addParam(new xmlrpcval("hr.applicant.question.list", "string"));
$msg1->addParam(new xmlrpcval("write", "string"));
$msg1->addParam(new xmlrpcval('hr_applicant_question_list_cursor', "string"));
$msg1->addParam(new xmlrpcval($ids, "array"));
$msg1->addParam(new xmlrpcval($arrayVal1, "array"));
And I receive the following error:
Traceback (most recent call last): File "/opt/openerp/server/openerp/wsgi/core.py", line 79, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params) File "/opt/openerp/server/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 586, in dispatch res = fn(db, uid, *params) File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper return f(self, dbname, *args, **kwargs)
File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/server/openerp/osv/orm.py", line 3836, in write for field in vals.copy(): AttributeError: 'list' object has no attribute 'copy' [payload] => [hdrs] => Array ( [content-type] => text/xml [content-length] => 1269 [server] => Werkzeug/0.8.3 Python/2.7.3 [date] => Sat, 30 Aug 2014 16:41:12 GMT ) [_cookies] => Array ( ) [content_type] => text/xml [raw_data] => HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 1269 Server: Werkzeug/0.8.3 Python/2.7.3 Date: Sat, 30 Aug 2014 16:41:12 GMT faultCode 'list' object has no attribute 'copy' faultString Traceback (most recent call last):
File "/opt/openerp/server/openerp/wsgi/core.py", line 79, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params)
File "/opt/openerp/server/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 586, in dispatch res = fn(db, uid, *params) File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper return f(self, dbname, *args, **kwargs)
File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/opt/openerp/server/openerp/osv/orm.py", line 3836, in write for field in vals.copy(): AttributeError: 'list' object has no attribute 'copy' ) Error: Traceback (most recent call last): File "/opt/openerp/server/openerp/wsgi/core.py", line 79, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params)
File "/opt/openerp/server/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 586, in dispatch res = fn(db, uid, *params)
File "/opt/openerp/server/openerp/osv/osv.py", line 129, in wrapper return f(self, dbname, *args, **kwargs)
File "/opt/openerp/server/openerp/osv/osv.py", line 195, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/server/openerp/osv/osv.py", line 183, in execute_cr return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/server/openerp/osv/orm.py", line 3836, in write for field in vals.copy(): AttributeError: 'list' object has no attribute 'copy'
Thank you for any help.