[FIX] purchase: skip move if not linked to a purchase order

When this situation happens. the 'cost' is None and the web interface cannot handle this value, provoking a JS error. Thus, prefer to fallback on the standard way to get the cost: based on the current standard price of the product.
Fixes #1032
This commit is contained in:
Guewen Baconnier 2014-07-09 13:56:24 +02:00 committed by Martin Trigaux
parent 106cb1ec2b
commit d0a0b7d91d
1 changed files with 1 additions and 1 deletions

View File

@ -127,7 +127,7 @@ class stock_partial_picking(osv.osv_memory):
# Overridden to inject the purchase price as true 'cost price' when processing
# incoming pickings.
def _product_cost_for_average_update(self, cr, uid, move):
if move.picking_id.purchase_id:
if move.picking_id.purchase_id and move.purchase_line_id:
return {'cost': move.purchase_line_id.price_unit,
'currency': move.picking_id.purchase_id.pricelist_id.currency_id.id}
return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)