[FIX] stock: fix for deleting the move line from wizard
authorRifakat Haradwala (Open ERP) <rha@tinyerp.com>
Thu, 30 Jun 2011 11:34:39 +0000 (17:04 +0530)
committerRifakat Haradwala (Open ERP) <rha@tinyerp.com>
Thu, 30 Jun 2011 11:34:39 +0000 (17:04 +0530)
bzr revid: rha@tinyerp.com-20110630113439-b2djiuukuf65hbps

addons/stock/stock.py
addons/stock/wizard/stock_partial_picking.py

index 5bc4bd3..c16e2c5 100644 (file)
@@ -1176,13 +1176,12 @@ class stock_picking(osv.osv):
                 if move.state in ('done', 'cancel'):
                     continue
                 partial_data = partial_datas.get('move%s'%(move.id), False)
-                assert partial_data, _('Missing partial picking data for move #%s') % (move.id)
-                product_qty = partial_data.get('product_qty',0.0)
+                product_qty = partial_data and partial_data.get('product_qty') or 0.0
                 move_product_qty[move.id] = product_qty
-                product_uom = partial_data.get('product_uom',False)
-                product_price = partial_data.get('product_price',0.0)
-                product_currency = partial_data.get('product_currency',False)
-                prodlot_id = partial_data.get('prodlot_id')
+                product_uom = partial_data and partial_data.get('product_uom') or False
+                product_price = partial_data and partial_data.get('product_price') or 0.0
+                product_currency = partial_data and partial_data.get('product_currency') or False
+                prodlot_id = partial_data and partial_data.get('prodlot_id') or False
                 prodlot_ids[move.id] = prodlot_id
                 if move.product_qty == product_qty:
                     complete.append(move)
index 21af463..c926658 100644 (file)
@@ -154,11 +154,6 @@ class stock_partial_picking(osv.osv_memory):
             picking_type = self.get_picking_type(cr, uid, pick, context=context)
             moves_list = picking_type == 'in' and partial.product_moves_in or partial.product_moves_out
 
-            #Adding a check whether any move has been removed
-            if len(moves_list) < len(pick.move_lines):
-                raise osv.except_osv(_('Processing Error'),\
-                _('You cannot remove any move while validating the picking, rather you can set the quantity as zero!'))
-
             #Adding a check whether any move has been added
             if len(moves_list) > len(pick.move_lines):
                 raise osv.except_osv(_('Processing Error'),\
@@ -171,21 +166,18 @@ class stock_partial_picking(osv.osv_memory):
                     raise osv.except_osv(_('Processing Error'),\
                     _('You cannot add any new move while validating the picking, rather you can split the lines prior to validation!'))
 
-                if len(moves_list) == 1 and move.quantity == 0:
-                    raise osv.except_osv(_('Processing Error'), \
-                    _('bass la na kar!!'))
-
                 calc_qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, \
                                     move.quantity, move.move_id.product_uom.id)
 
                 #Adding a check whether any move line contains exceeding qty to original moveline
                 if calc_qty > move.move_id.product_qty:
                     raise osv.except_osv(_('Processing Error'),
-                    _('Processing quantity %d for %s is larger than the available quantity %d !')\
-                    %(move.quantity, move.product_id.name, move.move_id.product_qty))
+                    _('Processing quantity %d %s for %s is larger than the available quantity %d %s !')\
+                    %(move.quantity, move.product_uom.name, move.product_id.name,\
+                      move.move_id.product_qty, move.move_id.product_uom.name))
 
                 #Adding a check whether any move line contains qty less than zero
-                if calc_qty < 0:
+                if calc_qty <= 0:
                     raise osv.except_osv(_('Processing Error'), \
                             _('Can not process quantity %d for Product %s !') \
                             %(move.quantity, move.product_id.name))