[FIX] stock: expected singleton issue in quants when lot/sn number
If applied, this commit will solve the issue of the singleton when there are 2 quants with the same location and same products but one quant with a lot and another quant without a lot number. Steps to produce: - Create one quant with location-1 and without lot number. - Create another quant with location-1 but with the lot number. - Create 3rd quant with location-1 with same lot number as step2. The error will raise in 3rd step as it is not accepting the 2 quants where one is with lot number and another is without lot number. see - https://tinyurl.com/2hqrgmwm sentry - 4024572562 closes odoo/odoo#119152 X-original-commit: 05a7f5c04804423cfc3a833a1b3f0b5eec3fc147 Signed-off-by: Tiffany Chang <tic@odoo.com>
This commit is contained in:
@@ -803,7 +803,7 @@ class StockQuant(models.Model):
|
||||
self.product_id, self.location_id, lot_id=self.lot_id,
|
||||
package_id=self.package_id, owner_id=self.owner_id, strict=True)
|
||||
if quant:
|
||||
self.quantity = quant.quantity
|
||||
self.quantity = quant.filtered(lambda q: q.lot_id == self.lot_id).quantity
|
||||
|
||||
# Special case: directly set the quantity to one for serial numbers,
|
||||
# it'll trigger `inventory_quantity` compute.
|
||||
|
||||
Reference in New Issue
Block a user