Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4613 Widoki

I want to be able to add all products to stock by creating individual stock receipts and track them with individual serial numbers.

But if I add a product to stock.product.line and then create a stock.production.lot number for it- first I get an error  'You can only process 1.0 Unit(s) for products with unique serial number.'.

I added an onchange function to add a product_uom_qty, but when I check the created lots, it says that item quantity is 0


@api.onchange('product_id', 'product_uom_id')
def onchange_add_reserved(self):
self.product_uom_qty = (1)


How would I properly update product_qty through stock.pick.line? In the code I see there is even an error waiting if I try to change the field:

raise UserError(_('The requested operation cannot be processed because of a programming error setting the `product_qty` field instead of the `product_uom_qty`.'))

I tried simply to:
@api.onchange('product_uom_qty')
def onchange_add_qty(self):
self.product_qty = (1)

But this doesn't work.

EDIT: I guess I need to somehow create a quant manually? Because it seem when any product is simply added through Receipts- doesn't have any moves/ quants associated with it, and thus Item doesn't really get added.. What's the point of being able to add items through stock.move.line manually, if that doesn't really create an item in inventory anyway?
Awatar
Odrzuć
Autor Najlepsza odpowiedź

I only needed to edit the operation.

  • Before: Input -> Stock

  • Now: Partner Location -> Stock

This way the quant gets properly created during the order receipt operation.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
mar 25
9010
2
kwi 20
4201
2
wrz 18
4696
9
cze 23
13039
0
lut 23
2545