Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how do i call onchange on many2many that will return domain to another many2many field using xmlrpc in php

By
chirag jogi
on 3/22/16, 6:01 AM 790 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

1
Motez
On 3/22/16, 10:18 AM

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"));

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/22/16, 6:01 AM
Seen: 790 times
Last updated: 3/22/16, 10:18 AM