[FIX] stock: error on stock.partial.move creation
authorMartin Trigaux <mat@openerp.com>
Wed, 24 Sep 2014 08:27:40 +0000 (10:27 +0200)
committerMartin Trigaux <mat@openerp.com>
Wed, 24 Sep 2014 08:30:44 +0000 (10:30 +0200)
The stock_partial_move wizard removes the required attribute for the field picking_id on a stock.partial.move. This means that we could get moves without picking_id and the previous line was failing ('NoneType' object has no attribute 'currency_id'). opw 614531

addons/stock/wizard/stock_partial_picking.py

index 4d36449..5419d2d 100644 (file)
@@ -163,7 +163,7 @@ class stock_partial_picking(osv.osv_memory):
             'move_id' : move.id,
             'location_id' : move.location_id.id,
             'location_dest_id' : move.location_dest_id.id,
-            'currency': move.picking_id.company_id.currency_id.id,
+            'currency': move.picking_id and move.picking_id.company_id.currency_id.id or False,
         }
         if move.picking_id.type == 'in' and move.product_id.cost_method == 'average':
             partial_move.update(update_cost=True, **self._product_cost_for_average_update(cr, uid, move))