Odoo Help


How to calculate price by xml-rpc?

on 11/13/13, 12:02 PM 2,484 views

I want to get product price for client (partner) using xml-rpc in php. I have this request:

$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($this->database, "string"));
$msg->addParam(new xmlrpcval($this->uid, "int"));
$msg->addParam(new xmlrpcval($this->password, "string"));
$msg->addParam(new xmlrpcval("product.pricelist", "string"));
$msg->addParam(new xmlrpcval("price_get", "string"));
$msg->addParam(new xmlrpcval($id_val, "array"));
$msg->addParam(new xmlrpcval($prod_id, "int")); //Problem here???
$msg->addParam(new xmlrpcval($quant, "double"));
$resp = $client->send($msg);

Then I get: Error: :dictionary key must be string If I set $prod_id, "string" - I get:

price_get AttributeError: 'NoneType' object has no attribute 'id'

What do I do wrong?

On 11/30/13, 6:26 AM

From my understanding, the "price_get" method works with price list ID, not partner id.

So you have to provide :
-id of the pricelist
-id of the product
-the quantity

in python :

 object.execute_kw('demo', 1, '*', 'product.pricelist', 'price_get', ([3], 34, 10), {})

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

1 follower(s)


Asked: 11/13/13, 12:02 PM
Seen: 2484 times
Last updated: 3/16/15, 8:10 AM