[FIX] stock: error if not assigned
When the user validates a picking without going through the manual reservation process, Odoo tries to assign the picking then performs the transfer. However, if the picking could not be assigned, no pack operation is created and the picking will simply be set to done. The fix raises an error if the picking could not be assigned completely. Another solution is to use a force_assign instead of action_assign, but that could lead to the creation of negative stock moves without warning the user. We therefore prefer to stay on the safe side and force the user to manually handle the reservation. Note: the original issue was that the Owner of the picking was not copied on the quant when validating right away. The reason was that no pack operation was created. opw-654423
This commit is contained in:
@@ -1201,6 +1201,12 @@ msgstr ""
|
||||
msgid "Corridor (X)"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: code:addons/stock/wizard/stock_immediate_transfer.py:31
|
||||
#, python-format
|
||||
msgid "Could not reserve all requested products. Please use the 'Mark as Todo' button to handle the reservation manually."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: model:ir.ui.view,arch_db:stock.view_backorder_confirmation
|
||||
msgid "Create Backorder"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp import models, fields, api
|
||||
from openerp import models, fields, api, _
|
||||
from openerp.tools import float_compare
|
||||
from openerp.exceptions import UserError
|
||||
|
||||
class stock_immediate_transfer(models.TransientModel):
|
||||
_name = 'stock.immediate.transfer'
|
||||
@@ -26,6 +27,8 @@ class stock_immediate_transfer(models.TransientModel):
|
||||
self.pick_id.action_confirm()
|
||||
if self.pick_id.state != 'assigned':
|
||||
self.pick_id.action_assign()
|
||||
if self.pick_id.state != 'assigned':
|
||||
raise UserError(_("Could not reserve all requested products. Please use the \'Mark as Todo\' button to handle the reservation manually."))
|
||||
for pack in self.pick_id.pack_operation_ids:
|
||||
if pack.product_qty > 0:
|
||||
pack.write({'qty_done': pack.product_qty})
|
||||
|
||||
Reference in New Issue
Block a user