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 to calculate price by xml-rpc?

By
Saulius
on 11/13/13, 12:02 PM 1,947 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?

0
cd
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), {})

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: 11/13/13, 12:02 PM
Seen: 1947 times
Last updated: 3/16/15, 8:10 AM