تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4662 أدوات العرض

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?
الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
مارس 25
9063
2
أبريل 20
4248
2
سبتمبر 18
4749
9
يونيو 23
13106
0
فبراير 23
2584