Skip to Content
Menu
This question has been flagged

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?
Avatar
Discard
Author Best Answer

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.

Avatar
Discard
Related Posts Replies Views Activity
3
Sep 20
7259
2
Apr 20
3308
2
Sep 18
4001
9
Jun 23
11133
0
Feb 23
1489