Skip to Content
Menu
This question has been flagged
1 Reply
6534 Views

I'hv define onchange in odoo 9 on many2many field how do i call in xmlrpc in php

My onchange function in odoo-9 which returns domain to another many2many field

@api.multi

@api.onchange('cpu_lines','motherboard_lines')

def onchange_get_comp_component(self):

cpu_rec_lines=self.cpu_lines

socket_type_list=[]

domain={}

if cpu_rec_lines:

for record in cpu_rec_lines:

socket_type_list.append(record.socket_type.id)

if record.socket_type:

domain.update({'motherboard_lines':[('socket','in',socket_type_list)]})

return {'domain':domain}


when I am trying to call onchange in following code

calling function

public function button_click($model, $method, $record_ids){

$client = new xmlrpc_client($this->server."object");

$client->setSSLVerifyPeer(0);

$client->return_type = 'phpvals';

// ['execute','userid','password','module.name',{values....}]

$nval = array();

$msg = new xmlrpcmsg('execute');

$msg->addParam(new xmlrpcval($this->database, "string")); //* database name */

$msg->addParam(new xmlrpcval($this->uid, "int")); /* useid */

$msg->addParam(new xmlrpcval($this->password, "string"));/** password */

$msg->addParam(new xmlrpcval($model, "string"));/** model name where operation will held * */

$msg->addParam(new xmlrpcval($method, "string"));/** method which u like to execute */

$msg->addParam(new xmlrpcval($record_id, "int"));/** parameters of the methods with values.... */

$resp = $client->send($msg);

if ($resp->faultCode())

return -1; /* if the record is not created */

else

return $resp->value(); /* return new generated id of record */

}

$srch_cmp=$helper->button_click('my_model_name','onchange_get_comp_component',$Id)

how do I call onchange on many2many fields(cpu_lines) that will return domain to another many2many field(motherboard_lines) in xmlrpc php


Thanks in advance

Avatar
Discard
Best Answer

You should add 'cpu_lines'  to the method args in your call. Try to replace 

  $msg->addParam(new xmlrpcval($record_id, "int"));/** parameters of the methods with values.... */

with  :

 $msg->addParam(new xmlrpcval(array($record_id, cpu_lines), "array"));
Avatar
Discard