I tried several different ways and calls and I finally have things typed correctly, but after several attempts I can't get past this last error. I've tried calling product.product name_search and I get back ID 1 for the product I want a price for. However, in the product.pricelist model, I've called price_get and price_get_multi and both fail the same way:
Fault returned from XML RPC Server, fault code 2: No value found for product.product('1',).product_tmpl_id
My goal is to lookup the current price of a product for a particular customer, given the current price list.
Here's the code that I'm using with some of my other attempts commented out:
sub get_labor_price {
my ($pricelistid) = @_;
my ($uid, $server, $index);
$server = Frontier::Client->new('url' => $Hours2odoo::Config{O_SERVERURL}.'/xmlrpc/common');
$uid = $server->call('login',$Hours2odoo::Config{O_DBNAME},$Hours2odoo::Config{O_USERNAME},$Hours2odoo::Config{O_PASSWORD});
print "UID: $uid\n" if ${DEBUG}>=10;
$server = Frontier::Client->new('url' => $Hours2odoo::Config{O_SERVERURL}.'/xmlrpc/2/object');
my $query = [
['name', '=', 'LAB-Hours'],
];
=begin
my $productprice = $server->call('execute',
$Hours2odoo::Config{O_DBNAME}, $uid, $Hours2odoo::Config{O_PASSWORD},
'product.product', 'search_read', $query
);
#print Dumper($productprice);
=cut
print 'Pricelist ID: '.$pricelistid."\n";
my $productid=$Hours2odoo::Config{O_PARTID};
#self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product, qty or 1.0, partner_id, {'uom': 'Hours', 'date': date_order, })
my $productprice = $server->call('execute',
$Hours2odoo::Config{O_DBNAME}, $uid, $Hours2odoo::Config{O_PASSWORD},
# 'product.pricelist', 'price_get', $server->int($pricelistid), $server->string($productid), $server->string(6)
'product.pricelist', 'price_get', $server->int($pricelistid), $server->string($productid), $server->int(6)
# 'product.pricelist', 'price_get_multi', $server->string($pricelistid),
# [
# [$productid, 1, 6],
# ],
);
print "PRICE: $productprice\n";
}
This is generating an XML request like this:
<?xml version="1.0"?>
<methodCall>
<methodName>execute</methodName>
<params>
<param><value><string>SBS</string></value></param>
<param><value><i4>1</i4></value></param>
<param><value><string>xxxxxxxxx</string></value></param>
<param><value><string>product.pricelist</string></value></param>
<param><value><string>price_get</string></value></param>
<param><value><int>5</int></value>
</param>
<param><value><string>1</string></value>
</param>
<param><value><string>6</string></value>
</param>
</params>
</methodCall>
The response is this:
<?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>2</int></value>
</member>
<member>
<name>faultString</name>
<value><string>No value found for product.product('1',).product_tmpl_id</string></value>
</member>
</struct></value>
</fault>
</methodResponse>
I would appreciate any insight into why this is not workout the way I expected. Thank you!
Steve