From 05d417bcd7c8a3d76a1967187a38a147ed28fb18 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Thu, 2 Apr 2009 19:15:15 +0200 Subject: [PATCH] Use product cost_price only if not already in vals in create method of stock.move --- move.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/move.py b/move.py index b45136c440..15e9e1bed2 100644 --- a/move.py +++ b/move.py @@ -459,10 +459,11 @@ class Move(ModelSQL, ModelView): cursor, user, vals['product'], -vals['quantity'], vals['uom'], vals['unit_price'], vals['currency'], vals['company'], context=context) - #Re-read the product because cost_price has been updated - product = product_obj.browse(cursor, user, vals['product'], - context=context) - vals['cost_price'] = product.cost_price + if not vals.get('cost_price'): + product = product_obj.browse(cursor, user, vals['product'], + context=context) + vals['cost_price'] = product.cost_price + elif vals.get('state') == 'assigned': if not vals.get('effective_date'): vals['effective_date'] = datetime.date.today()