Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3527 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

stock valuation using filters, do not solve this?

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
7
thg 4 18
10328
2
thg 8 25
469
1
thg 7 21
3857
4
thg 8 24
14449
2
thg 3 23
8584