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

I get the qty_available (quantity on hand) using self.env['product.product']._compute_quantities_dict(False,False,False,from_date=False, to_date=end_date) , this function can be found in the stock module.

Ex:

(Default)The location_id is Main and the location_dest_id is inventory then the QoH is 200. BUT

I also want to get the QoH if location_dest_id is from the adjustment which is 50.

I want to change the location(location_dest_id) where it get the qty_available(quantity on hand) based on the location_dest_id ,


how can I achieve this? Do I need to use with_context()?But how? I want to change both the source and destination location

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

Hi,

Just pass the location_id and location_dest_id in the context and see whether it works.

Eg:- 

product.with_context({'location' : LOCATION_ID}).qty_available

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Dear Niyas,

How can I add specific source and destination? I used the code u mentioned but the source if from all location then the destination is to location_id?

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
184
0
ก.ค. 25
354
2
มิ.ย. 25
1378
1
พ.ค. 25
1391
0
มี.ค. 25
1240