Update cost_price only from supplier to storage

review163006
This commit is contained in:
Cédric Krier committed 2011-11-04 17:20:34 +01:00
1 parent f6b35baa82
commit c0d32c5df5
2 files changed
+18 -12

No files matched your search

+2
View File
@@ -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
+16 -12
View File
@@ -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)