Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions addons/stock/i18n/stock.pot
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ msgstr ""
msgid "A serial number should only be linked to a single product."
msgstr ""

#. module: stock
#: code:addons/stock/models/stock_quant.py:81
#, python-format
msgid "Serial %s of product %s would have a quantity of %f."
msgstr ""

#. module: stock
#: model:ir.model.fields,help:stock.field_product_product__type
#: model:ir.model.fields,help:stock.field_product_template__type
Expand Down
4 changes: 3 additions & 1 deletion addons/stock/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def check_product_id(self):
def check_quantity(self):
for quant in self:
if float_compare(quant.quantity, 1, precision_rounding=quant.product_uom_id.rounding) > 0 and quant.lot_id and quant.product_id.tracking == 'serial':
raise ValidationError(_('A serial number should only be linked to a single product.'))
msg = _('A serial number should only be linked to a single product.')
msg += " " + _('Serial %s of product %s would have a quantity of %f.') % (quant.lot_id.name, quant.product_id.display_name, quant.quantity)
raise ValidationError(msg)

@api.constrains('location_id')
def check_location_id(self):
Expand Down