diff --git a/stock.py b/stock.py index 41b02cf183..c71c7242bf 100644 --- a/stock.py +++ b/stock.py @@ -551,11 +551,11 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView): if qty: product_cost[product] = round_price(cost / qty) - for c_move in shipment.customer_moves: - cost_price = product_cost[c_move.product] - if cost_price != c_move.cost_price: - c_move.cost_price = cost_price - to_save.append(c_move) + for move in shipment.moves: + cost_price = product_cost[move.product] + if cost_price != move.cost_price: + move.cost_price = cost_price + to_save.append(move) if to_save: Move.save(to_save) diff --git a/tests/scenario_sale_supply_drop_shipment.rst b/tests/scenario_sale_supply_drop_shipment.rst index c7035e8a54..369544bdca 100644 --- a/tests/scenario_sale_supply_drop_shipment.rst +++ b/tests/scenario_sale_supply_drop_shipment.rst @@ -282,6 +282,9 @@ Receive purchase invoice at different price:: >>> shipment, = [s for s in purchase.drop_shipments ... if s.state == 'done'] + >>> move, = shipment.supplier_moves + >>> move.cost_price + Decimal('4.0000') >>> move, = shipment.customer_moves >>> move.cost_price Decimal('4.0000')