From 6a473e4565130d274d7064d03c4b70f901dcc1b0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 20 Apr 2016 19:59:30 +0200 Subject: [PATCH] [FIX] stock_landed_costs: fix the fix of the tests Commit 6339bae87 fixes the tests, but now the tests are not testing what should be tested ;-) --- .../test/stock_landed_costs_rounding.yml | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/addons/stock_landed_costs/test/stock_landed_costs_rounding.yml b/addons/stock_landed_costs/test/stock_landed_costs_rounding.yml index fd2ff25e297..2f237e6751a 100644 --- a/addons/stock_landed_costs/test/stock_landed_costs_rounding.yml +++ b/addons/stock_landed_costs/test/stock_landed_costs_rounding.yml @@ -13,7 +13,6 @@ - !record {model: product.product, id: product_landed_cost_3}: name: "LC product 3" - standard_price: 10 cost_method: real uom_id: product_uom_unit_round_1 valuation: real_time @@ -22,7 +21,6 @@ - !record {model: product.product, id: product_landed_cost_4}: name: "LC product 4" - standard_price: 8 cost_method: real uom_id: product_uom_unit_round_1 valuation: real_time @@ -59,15 +57,17 @@ I receive picking LC_pick_3, and check how many quants are created - !python {model: stock.picking}: | + pick = self.browse(cr, uid, [ref("picking_landed_cost_3")], context=context) + pick.move_lines.price_unit = 1.0 + self.action_confirm(cr, uid, [ref("picking_landed_cost_3")], context=context) self.action_assign(cr, uid, [ref("picking_landed_cost_3")], context=context) self.action_done(cr, uid, [ref("picking_landed_cost_3")], context=context) - pick = self.browse(cr, uid, [ref("picking_landed_cost_3")], context=context) quants = pick.move_lines.quant_ids assert len(quants) == 1 assert quants.qty == 13 - assert quants.cost == 10.0 + assert quants.cost == 1.0 - I create a landed cost for picking 3 - @@ -111,22 +111,24 @@ for valuation in landed_cost.valuation_adjustment_lines: quants = valuation.move_id.quant_ids assert quants.mapped('qty') == [12.0, 1.0] - assert quants.mapped('cost') == [11.15, 11.2] + assert quants.mapped('cost') == [2.15, 2.2] - We perform all the tests for LC_pick_4 - I receive picking LC_pick_4, and check how many quants are created - !python {model: stock.picking}: | + pick = self.browse(cr, uid, [ref("picking_landed_cost_4")], context=context) + pick.move_lines.price_unit = 17.0/12.0 + self.action_confirm(cr, uid, [ref("picking_landed_cost_4")], context=context) self.action_assign(cr, uid, [ref("picking_landed_cost_4")], context=context) self.action_done(cr, uid, [ref("picking_landed_cost_4")], context=context) - pick = self.browse(cr, uid, [ref("picking_landed_cost_4")], context=context) quants = pick.move_lines.quant_ids - assert len(quants) == 1 - assert quants.mapped('qty') == [12.0] - assert [round(c, 2) for c in quants.mapped('cost')] == [8.0] + assert len(quants) == 2 + assert quants.mapped('qty') == [11.0, 1.0] + assert [round(c, 2) for c in quants.mapped('cost')] == [1.42, 1.38] - I create a landed cost for picking 4 - @@ -170,4 +172,4 @@ for valuation in landed_cost.valuation_adjustment_lines: quants = valuation.move_id.quant_ids assert quants.mapped('qty') == [11.0, 1.0] - assert [round(c, 2) for c in quants.mapped('cost')] == [8.92, 8.88] + assert [round(c, 2) for c in quants.mapped('cost')] == [2.34, 2.26]