I am trying to update some information on my odoo product with PHP and xmlrpc. This is my code for update product name.
$models->execute_kw($db, $uid, $password, 'product.product', 'write',
array(array(5), array('name'=>"Newer product 3",'type'=>"consu")));
Now I want to change a "Quantity On Hand" field so I trying this code :
$models->execute_kw($db, $uid, $password, 'product.product', 'write',
array(array(5), array('name'=>"Newer product 3",'type'=>"consu",'qty_available'=>'7')));
but it doesn't work, anyone got any ideas how to fix it? Thank you.
The field qty_available is readonly.
On odoo10 you can use the following operation, python:
product = models.execute_kw(db, uid, password, 'product.product', 'search', [[('default_code', '=', sku)]])
change_id = models.execute_kw(db, uid, password, 'stock.change.product.qty', 'create', [{
'product_id': product[0],
'location_id': 15,
'new_quantity': 20,
}])
models.execute_kw(db, uid, password, 'stock.change.product.qty', 'change_product_qty', [change_id])
Since the field qty_available is read only there is no way to update it.
To update it you'll need to create a stock move
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With