Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
2954 Переглядів

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



Аватар
Відмінити
Автор Найкраща відповідь

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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
лют. 24
524
2
вер. 24
4889
3
лип. 23
3099
1
серп. 20
7993
2
січ. 19
8415