Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2836 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
úno 24
524
2
zář 24
4715
3
čvc 23
3013
1
srp 20
7911
2
led 19
8305