Skip to Content
Menu
This question has been flagged
1 Reply
1607 Views

I've been trying to automate the picking of some products. I want to create a new lot number associated to a product (working for me), but then I also want to update its corresponding quantity, and here is where I'm having the problem.

If the lot/product has 0 quantity, it does not appear on the inventory adjustment view, so it does not exist on "stock.quant" model. 


If it doesn't show up here, I can't update it with the following command:


update_qty = models.execute_kw(db, uid, password, 'stock.quant', 'write', [id], {'quantity': '150'}])

The 'write' action does not work if is not created, and the 'create' action does not work because it says you can't create on a view screen or something similar.


I have also tried to update it at the same time that I create the lot, but the field is read only.

So I must be missing something, there should be a way to update this stock from another place.

I would appreciate any help.


Thanks



Avatar
Discard
Author Best Answer

Solved it after trying a few things.

First of all, I created a new entry on stock.move, with all the info necessary. The problem is that on stock.move there is nowhere to specifyt the lot.
But, creating that stock.move entry also creates a new line on stock.move.lines, where the lot number is a valid field. So i just had to write on that new line to add the lot and confirm everything and it works.

So yeah, a two step process, and a bit ugly...
I don't know if it's the correct way, but it does the job for me currently.

Avatar
Discard
Related Posts Replies Views Activity
0
Feb 24
524
2
Sep 24
2069
3
Jul 23
1671
1
Aug 20
6626
2
Jan 19
7135