跳至內容
選單
此問題已被標幟
1 回覆
2431 瀏覽次數

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?

頭像
捨棄
作者 最佳答案
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,
})
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
9月 17
9426
0
11月 15
3169
2
12月 20
2909
1
3月 15
4797
2
5月 25
792