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

Call on_change from PHP XML-RPC

php
By
Francesco OpenCode
on 2/19/13, 11:38 AM 1,783 views

I want call a onchange_function from a PHP page via xml-rpc. How can do it?

anyone knows the answer to this?

Adrian
on 2/27/13, 7:26 AM
1
Marco Dieckhoff
On 3/5/13, 5:54 AM

simply use the name of the onchange function as 5th parameter:

compare:

    $sock = new xmlrpc_client($this->OPENERP_SERVER.'object');
    $msg = new xmlrpcmsg('execute');
    $msg->addParam(new xmlrpcval($this->OpenERP_DB, "string"));
    $msg->addParam(new xmlrpcval($this->OpenERP_UserID, "int"));
    $msg->addParam(new xmlrpcval($this->OpenERP_Pass, "string"));
    $msg->addParam(new xmlrpcval($model, "string"));
    $msg->addParam(new xmlrpcval("search", "string"));

read, write or create would be other examples of a 5th param. So can your onchange or any other function name.

Actually, read, write or create are also simply just functions on your model, inherited from osv.osv.

    $sock = new xmlrpc_client($this->OPENERP_SERVER.'object');
    $msg = new xmlrpcmsg('execute');
    $msg->addParam(new xmlrpcval($this->OpenERP_DB, "string"));
    $msg->addParam(new xmlrpcval($this->OpenERP_UserID, "int"));
    $msg->addParam(new xmlrpcval($this->OpenERP_Pass, "string"));
    $msg->addParam(new xmlrpcval($model, "string"));
    $msg->addParam(new xmlrpcval("onchange_function", "string"));

Don't forget to add your params to the onchange_function next, just like search, read, create or write params.

    $msg->addParam(new xmlrpcval($params, "array"));

hth, dieck

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

0 follower(s)

Stats

Asked: 2/19/13, 11:38 AM
Seen: 1783 times
Last updated: 3/16/15, 8:10 AM