Odoo Help


how to connect php with openerp ,Please help me with a module sample

on 4/14/14, 7:20 AM 2,621 views

Python example

import xmlrpclib

... define HOST, PORT, DB, USER, PASS

url = 'http://%s:%d/xmlrpc/common' % (HOST,PORT) sock = xmlrpclib.ServerProxy(url) uid = sock.login(DB,USER,PASS) print "Logged in as %s (uid:%d)" % (USER,uid)

Create a new idea

url = 'http://%s:%d/xmlrpc/object' % (HOST,PORT) sock = xmlrpclib.ServerProxy(url)

args = { 'name' : 'Another idea', 'description' : 'This is another idea of mine', 'inventor_id': uid, } idea_id = sock.execute(DB,uid,PASS,'idea.idea','create',args) PHP example

$msg = new xmlrpcmsg("login"); $msg->addParam(new xmlrpcval($DB, "string")); $msg->addParam(new xmlrpcval($USER, "string")); $msg->addParam(new xmlrpcval($PASS, "string")); resp = $client->send($msg); uid = $resp->value()->scalarval() echo "Logged in as $USER (uid:$uid)"

// Create a new idea $arrayVal = array( 'name'=>new xmlrpcval("Another Idea", "string") , 'description'=>new xmlrpcval("This is another idea of mine" , "string"), 'inventor_id'=>new xmlrpcval($uid, "int"), );

$msg = new xmlrpcmsg('execute'); $msg->addParam(new xmlrpcval($DB, "string")); $msg->addParam(new xmlrpcval($uid, "int")); $msg->addParam(new xmlrpcval($PASS, "string")); $msg->addParam(new xmlrpcval("idea.idea", "string")); $msg->addParam(new xmlrpcval("create", "string")); $msg->addParam(new xmlrpcval($arrayVal, "struct")); $resp = $client->send($msg);



Jagdish Panchal

--Jagdish Panchal--
Jagdish Panchal
| 5 4 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/14/14, 7:24 AM


This link will help you



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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/14/14, 7:20 AM
Seen: 2621 times
Last updated: 3/16/15, 8:10 AM