[FIX] stock: Wrong error when you work with lot owner
When a stock move was created in a picking with a product set with a unique serial number existing in the stock of a specific owner. If the owner was not specified for the stock move then a wrong message was raised "The serial number 00005 is already in stock.". But the real problem could come from function quants_get_preferred_domain which didn't find the existing quant due to the fact that the system didn't check in the right stock(owner). A new quant was then created with the existing serial number. And a wrong message was raised. opw:671783
This commit is contained in:
@@ -3666,6 +3666,12 @@ msgstr ""
|
||||
msgid "Original Move"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: code:addons/stock/stock.py:576
|
||||
#, python-format
|
||||
msgid "Otherwise make sure the right stock/owner is set."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: model:ir.model.fields,field_description:stock.field_stock_warehouse_out_type_id
|
||||
msgid "Out Type"
|
||||
|
||||
@@ -573,7 +573,7 @@ class stock_quant(osv.osv):
|
||||
('qty', '>', 0.0), ('location_id.usage', '=', 'internal')], context=context)
|
||||
if other_quants:
|
||||
lot_name = self.pool['stock.production.lot'].browse(cr, uid, lot_id, context=context).name
|
||||
raise UserError(_('The serial number %s is already in stock') % lot_name)
|
||||
raise UserError(_('The serial number %s is already in stock.') % lot_name + _("Otherwise make sure the right stock/owner is set."))
|
||||
|
||||
#create the quant as superuser, because we want to restrict the creation of quant manually: we should always use this method to create quants
|
||||
quant_id = self.create(cr, SUPERUSER_ID, vals, context=context)
|
||||
|
||||
Reference in New Issue
Block a user