From 3dc4b0a0765bcfc895aa57d54bbed83c1b343571 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Wed, 21 Jan 2015 19:44:58 +0100 Subject: [PATCH] Add test for cost by value allocation with zero moves value issue4439 review7841002 --- tests/scenario_purchase_shipment_cost.rst | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/scenario_purchase_shipment_cost.rst b/tests/scenario_purchase_shipment_cost.rst index 93b1a34cfe..95cc6b40d1 100644 --- a/tests/scenario_purchase_shipment_cost.rst +++ b/tests/scenario_purchase_shipment_cost.rst @@ -138,3 +138,28 @@ Receive many product lines:: >>> [move.unit_price for move in shipment.incoming_moves] == \ ... [Decimal('8.3333'), Decimal('8.3333'), Decimal('8.3334')] True + +Receive a two lines with no cost:: + + >>> shipment = ShipmentIn() + >>> shipment.supplier = supplier + >>> move = shipment.incoming_moves.new() + >>> move.from_location = supplier_location + >>> move.to_location = shipment.warehouse.input_location + >>> move.product = product + >>> move.quantity = 75 + >>> move.unit_price = Decimal('0.0') + >>> move = shipment.incoming_moves.new() + >>> move.from_location = supplier_location + >>> move.to_location = shipment.warehouse.input_location + >>> move.product = product + >>> move.quantity = 25 + >>> move.unit_price = Decimal('0.0') + >>> shipment.carrier = carrier + >>> shipment.cost + Decimal('3') + >>> shipment.click('receive') + >>> shipment.state + u'received' + >>> tuple(m.unit_price for m in shipment.incoming_moves) + (Decimal('0.0600'), Decimal('0.0200'))