[FIX] stock: prevent transfer of picking

In a large warehouse, it can happen that two users try to transfer the
same picking at the same time.

opw-668725
This commit is contained in:
Nicolas Martinelli 2016-02-22 11:10:56 +01:00
parent 488c693109
commit f89220a513
2 changed files with 24 additions and 2 deletions

View File

@ -4941,6 +4941,12 @@ msgstr ""
msgid "Types of Operation"
msgstr ""
#. module: stock
#: code:addons/stock/stock.py:663
#, python-format
msgid "Under no circumstances should you delete or change quants yourselves!"
msgstr ""
#. module: stock
#: help:stock.production.lot,name:0
msgid "Unique Serial Number"
@ -5315,7 +5321,13 @@ msgid "You cannot cancel a stock move that has been set to 'Done'."
msgstr ""
#. module: stock
#: code:addons/stock/stock.py:638
#: code:addons/stock/stock.py:2958
#, python-format
msgid "You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validate the first inventory adjustement with this product before creating another one."
msgstr ""
#. module: stock
#: code:addons/stock/stock.py:657
#, python-format
msgid "You cannot move to a location of type view %s."
msgstr ""
@ -5340,7 +5352,13 @@ msgid "You cannot split a move done"
msgstr ""
#. module: stock
#: code:addons/stock/wizard/stock_return_picking.py:132
#: code:addons/stock/wizard/stock_transfer_details.py:79
#, python-format
msgid "You cannot transfer a picking in state '%s'."
msgstr ""
#. module: stock
#: code:addons/stock/wizard/stock_return_picking.py:135
#, python-format
msgid "You have manually created product lines, please delete them to proceed"
msgstr ""

View File

@ -20,6 +20,7 @@
##############################################################################
from openerp import models, fields, api
from openerp.exceptions import Warning
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from datetime import datetime
@ -74,6 +75,9 @@ class stock_transfer_details(models.TransientModel):
@api.one
def do_detailed_transfer(self):
if self.picking_id.state not in ['assigned', 'partially_available']:
raise Warning(_('You cannot transfer a picking in state \'%s\'.') % self.picking_id.state)
processed_ids = []
# Create new and update existing pack operations
for lstits in [self.item_ids, self.packop_ids]: