What is the best way to add suppliers to all of my products? I have an Excel list with all of my products and skus, which are also already in Odoo, but the link in between is missing. What is the best way to link suppliers with products programmatically?
OK guys, here is my solution in PHP:
$url = "xxx";
$db = "xxx";
$username = "xxx";
$password = "xxx";
$sku = $data;
$supplier_relation = $data;
$product_code = $data;
$common = ripcord::client("$url/xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, array());
$models = ripcord::client("$url/xmlrpc/2/object");
//get odoo product id
$product = $models->execute_kw($db, $uid, $password,
array(array(array('default_code', '=', $sku)))
//create supplier relation
$models->execute_kw($db, $uid, $password,
array(array('name' => $supplier_relation, 'min_qty' => 0, 'delay' => 10, 'product_tmpl_id' => $product['id'], 'product_code' => $product_code))
Its better if you write a script to read your excel file(that must have product_name, supplier_name, and qty_supplied) and
create a record for each supplier for respective product(for object "product.supplier_info") and tag these records to the corresponding product.
As there is a one2many for product.supplier_info in product.product, you can simply refer record to it.
Hope it help
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
|Asked: 9/29/15, 8:17 AM|
|Seen: 502 times|
|Last updated: 10/1/15, 3:52 AM|