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

I'm trying to update Inventory product on hand quantity automatically from my module.

Basically, I search the same name in inventory

inventory_product_id = self.env['product.template'].search([('name','=',product.product_name)])

and creating new record for stock.product.lot as new serial number and after trying to write on hand quantity +1

lot_object = production_lot.search([('name','=',product.product_barcode)])
stock_obj = self.env['stock.quant']
stockvalues = {
'product_id': inventory_product_id.id,
'location_id': 8,
'lot_id':lot_object.id,
'inventory_quantity':1,
}
stock_obj.create(stockvalues)

But, when I run this script i get message:
Sorry, you are not allowed to create documents of type 'Quants' (stock.quant).
No group currently allows this operation. - (Operation: create, User: 2)
When I trying do the same as superuser, the script works but still doesn't put any numbers except 0 to on hand quantity.
Does somebody know some work around or different approaches to change on hand product quantity automatically in Inventory module?


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

Hi

Same problem i am facing but in odoo14. if anyone solve this i need help.

Thanks in advance

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

not worked for me. i create sock.move  and also create stock.move.item   but  stock.quant table empty and quantity not updated.

odoo14

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

Hello,

odoo13 is not allowed to do operation like that. if you want to achieve that things you have to create stock.move with product and it's quantity.

Regards,

Ankit Vaghela

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 19
5526
2
thg 3 25
3490
0
thg 1 23
2718
0
thg 1 21
1787
1
thg 6 25
3632