コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3501 ビュー

I want to get the value/amount from a particular location.


I call the stock_value field from product.product model, but it returns the value from overall location, I just want to get the value from a specific loc like if I have two locs Wh/Main and Wh/Extra, I only want to fetch it from extra, how can I do it, I tried the with_context but It has an error comparing apples and oranges.

アバター
破棄
最善の回答

stock valuation using filters, do not solve this?

アバター
破棄
著作者

I tried to use it like product_id.with_context({'location':self.location_id}).stock_value, but it still return the overall so I just use the sm = self.env['stock.move'].search([('location_id','=',self.location_id.id),('product_id','=',product_id.id)]) then a = sum([rec.value for rec in sm]) then I got what I wanted but I dunno if this is a way to do it, Im afraid it will slower the performance

最善の回答

There is a module here that make this function and its available for all versions 

https://apps.odoo.com/apps/modules/13.0/product_warehouse_quantity/

hope it will help you

アバター
破棄
関連投稿 返信 ビュー 活動
7
4月 18
10309
2
8月 25
462
1
7月 21
3846
4
8月 24
14445
2
3月 23
8568