Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3307 มุมมอง

I would like to query available stock for a given list of products, in a given location.

Currently I'm searching in stock.quant, with [['product_id.x_some_studio_field','in',[array of blah],['location_id.name','=',location_name]]

the problem with this approach is that it seems if the product never had stock entered in stock.quant, it will not return a line for the product.

Is it possible to query the product.product model, so I can read qty_available, but only for certain locations?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Hernan,

You can do the following to fetch the available quantities particular for that stock location

product.with_context( {'warehouse': your_warehouse_id}).qty_available 

Thanks

อวตาร
ละทิ้ง