Skip to Content
Menu
This question has been flagged

I get product.product object using the search method. Now I want to update its quantity in a specific warehouse (I have multiple warehouses) using ORM. how can I achieve it?

Avatar
Discard
Author Best Answer
stock_loc = self.env['stock.warehouse'].search([('name', '=', wh_name)],
limit=1)
product_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({
'product_id': product.id,
'inventory_quantity': quantity,
'location_id': stock_loc.lot_stock_id.id,
})
Avatar
Discard
Related Posts Replies Views Activity
1
Sep 17
8436
0
Nov 15
2330
2
Dec 20
1945
1
Mar 15
3941
4
Mar 22
30573