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?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- 项目
- MRP
此问题已终结
1
回复
2820
查看
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
|
9876 | ||
|
|
0
11月 15
|
3548 | ||
|
|
2
12月 20
|
3481 | ||
|
|
1
3月 15
|
5172 | ||
|
|
2
5月 25
|
1433 |