[IMP] stock: avoid errors with picking without quantity
authorMartin Trigaux <mat@odoo.com>
Fri, 31 Oct 2014 11:20:56 +0000 (12:20 +0100)
committerMartin Trigaux <mat@odoo.com>
Fri, 31 Oct 2014 11:32:08 +0000 (12:32 +0100)
When a line is not present in the partial delivery wizard, computation variables are initialized with generic values (zero quantity, zero price,...). Instead of setting the uom to False, keep the quantity of the move.
This makes a difference only when the quantity of the move is 0. That means that the move will be marked as complete and can be processed.
This avoids trying to update the stock.move with a uom at False. opw 616844

addons/stock/stock.py

index 644dae4..3b6bb70 100644 (file)
@@ -1248,7 +1248,7 @@ class stock_picking(osv.osv):
                 partial_data = partial_datas.get('move%s'%(move.id), {})
                 product_qty = partial_data.get('product_qty',0.0)
                 move_product_qty[move.id] = product_qty
-                product_uom = partial_data.get('product_uom',False)
+                product_uom = partial_data.get('product_uom', move.product_uom.id)
                 product_price = partial_data.get('product_price',0.0)
                 product_currency = partial_data.get('product_currency',False)
                 prodlot_id = partial_data.get('prodlot_id')