Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3452 Vizualizări

I want to update the available stock of a product, this is what I have:


    data = {
'product_id':product_rec.id,
'location_id': location_rec.id,
'inventory_quantity':product_qty
}
    self.env['stock.quant'].sudo().create(data)

Doesn't seem to update anything.
Thank you
Imagine profil
Abandonează
Cel mai bun răspuns

Hi Andreas.
Instead of 'inventory_quantity' , use quantity just like:

 self.env['stock.quant'].sudo().create({
'product_id':product_rec.id,
'location_id': location_rec.id,
'quantity':product_qty
})


But this is not the valid way for stock increase technique. Use a Odoo standard way for updating the stock. Please check the update quantity functionality from odoo base code.

For your internal programming, Hope it will help you. 
Imagine profil
Abandonează
Autor

Hi,
I changed 'inventory_quantity' to quantity but I still don't see any update in the product.
I also tried with _update_available_quantity() but no change.

Malay, could you please provide any pointers you have about the "update quantity functionality from odoo base code"? Something like GithHub source or documentation links.

Related Posts Răspunsuri Vizualizări Activitate
0
mai 25
11
2
ian. 25
2377
1
dec. 24
6085
1
nov. 24
2550
1
nov. 24
1897