[FIX] stock: Error message don't contain the name of product
The message don't show the name of product. Before the fix: The message was: "It is not possible to reserve more products of than you have in stock." After the fix: The message is: "It is not possible to reserve more products of [0221] Product A than you have in stock." opw:1868449
This commit is contained in:
committed by
Goffin Simon
parent
e91f10f14d
commit
3528e804de
@@ -262,12 +262,12 @@ class StockQuant(models.Model):
|
||||
# if we want to reserve
|
||||
available_quantity = self._get_available_quantity(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=strict)
|
||||
if float_compare(quantity, available_quantity, precision_rounding=rounding) > 0:
|
||||
raise UserError(_('It is not possible to reserve more products of %s than you have in stock.') % (', '.join(quants.mapped('product_id').mapped('display_name'))))
|
||||
raise UserError(_('It is not possible to reserve more products of %s than you have in stock.') % product_id.display_name)
|
||||
elif float_compare(quantity, 0, precision_rounding=rounding) < 0:
|
||||
# if we want to unreserve
|
||||
available_quantity = sum(quants.mapped('reserved_quantity'))
|
||||
if float_compare(abs(quantity), available_quantity, precision_rounding=rounding) > 0:
|
||||
raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.') % (', '.join(quants.mapped('product_id').mapped('display_name'))))
|
||||
raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.') % product_id.display_name)
|
||||
else:
|
||||
return reserved_quants
|
||||
|
||||
|
||||
Reference in New Issue
Block a user