Reviewers: ,
Please review this at http://codereview.tryton.org/163006/
Affected files:
M move.py
Index: move.py
===================================================================
--- a/move.py
+++ b/move.py
@@ -556,15 +556,17 @@
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)
@@ -581,15 +583,17 @@
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)
--
[email protected] mailing list