Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4678 Lượt xem

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?
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 25
9084
2
thg 4 20
4255
2
thg 9 18
4759
9
thg 6 23
13134
0
thg 2 23
2604