From f89220a51313e1bf46ec82175f2449c2e1a0455c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 22 Feb 2016 11:10:56 +0100 Subject: [PATCH] [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 --- addons/stock/i18n/stock.pot | 22 +++++++++++++++++-- addons/stock/wizard/stock_transfer_details.py | 4 ++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index 805485062d1..a271946b791 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -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 "" diff --git a/addons/stock/wizard/stock_transfer_details.py b/addons/stock/wizard/stock_transfer_details.py index 437509aacf3..d01ff370720 100644 --- a/addons/stock/wizard/stock_transfer_details.py +++ b/addons/stock/wizard/stock_transfer_details.py @@ -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]: