콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5690 화면

Good day everyone, 

We have a set of special products for which their inventory is handled on a legacy app and we need to have odoo in sync with that. Is there any kinda sample code of how to update the quantity on hand of a product from within a runing source code.


Thanks in advance.

아바타
취소
작성자 베스트 답변

thanks for reply Samir,  I found this sample code and adapted in my module , it updates the on hand quantity properly but left the stock records like something still pending.

here the code

[CODE UPDATED!] now works fine

warehouse = self.env['stock.warehouse'].search([('code', '=', 'T006')],limit=1)



new_quantity = 742

for product in products:

self.env['stock.quant'].with_context(inventory_mode=True).create({

'product_id': product.id,

'inventory_quantity': new_quantity,

'location_id': warehouse.lot_stock_id.id,

}).action_apply_inventory()




아바타
취소
베스트 답변

HI Sir

By using the inventory Adjustment , you can the ware location you need to update the product Quantity  

set the new count and apply it 

you can run that by batch 


아바타
취소
관련 게시물 답글 화면 활동
1
10월 23
1689
2
5월 18
4974
0
8월 17
3679
0
6월 23
1842
Inventory report 해결 완료
1
9월 21
2838