diff --git a/CHANGELOG b/CHANGELOG index de861b4d80..b7acce6c60 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Update cost_price only from supplier to storage + Version 2.2.0 - 2011-10-25 * Bug fixes (see mercurial logs for details) * Ensure coherence between planned date of shipments and moves diff --git a/move.py b/move.py index 74b9cf38cb..a207c025cc 100644 --- a/move.py +++ b/move.py @@ -555,15 +555,17 @@ class Move(ModelSQL, ModelView): for move in moves: if vals['state'] == 'cancel': vals['effective_date'] = False - if move.from_location.type == 'supplier' \ - and move.state != 'cancel' \ - and move.product.cost_price_method == 'average': + if (move.from_location.type == 'supplier' + and move.to_location.type == 'storage' + and move.state != 'cancel' + and move.product.cost_price_method == 'average'): self._update_product_cost_price(move.product.id, -move.quantity, move.uom, move.unit_price, move.currency, move.company, today) - if move.to_location.type == 'supplier' \ - and move.state != 'cancel' \ - and move.product.cost_price_method == 'average': + if (move.to_location.type == 'supplier' + and move.from_location.type == 'storage' + and move.state != 'cancel' + and move.product.cost_price_method == 'average'): self._update_product_cost_price(move.product.id, move.quantity, move.uom, move.unit_price, move.currency, move.company, today) @@ -580,15 +582,17 @@ class Move(ModelSQL, ModelView): self.raise_user_error('set_state_done') vals['effective_date'] = effective_date - if move.from_location.type == 'supplier' \ - and move.state != 'done' \ - and move.product.cost_price_method == 'average': + if (move.from_location.type == 'supplier' + and move.to_location.type == 'storage' + and move.state != 'done' + and move.product.cost_price_method == 'average'): self._update_product_cost_price(move.product.id, move.quantity, move.uom, move.unit_price, move.currency, move.company, effective_date) - if move.to_location.type == 'supplier' \ - and move.state != 'done' \ - and move.product.cost_price_method == 'average': + if (move.to_location.type == 'supplier' + and move.from_location.type == 'storage' + and move.state != 'done' + and move.product.cost_price_method == 'average'): self._update_product_cost_price( move.product.id, -move.quantity, move.uom, move.unit_price, move.currency, move.company, effective_date)