From 10da9045a6c63468736b6a678356058c95d43219 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 6 Jun 2018 13:23:26 +0200 Subject: [PATCH] [FIX] purchase: fix test The `price_unit` on `stock.move` is not rounded since it is a technical field. Therefore, the comparison might fail depending on the rate (which happens after June 6th because of `base.rateUSDbis`). --- addons/purchase/tests/test_stockvaluation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/purchase/tests/test_stockvaluation.py b/addons/purchase/tests/test_stockvaluation.py index f81e8eeceb8..320881309fe 100644 --- a/addons/purchase/tests/test_stockvaluation.py +++ b/addons/purchase/tests/test_stockvaluation.py @@ -182,7 +182,7 @@ class TestStockValuation(TransactionCase): 'company_id': po1.company_id.id, }) eur_currency._compute_current_rate() - price_unit_usd_new_rate = po1.currency_id.compute(po1.order_line.price_unit, po1.company_id.currency_id, round=True) + price_unit_usd_new_rate = po1.currency_id.compute(po1.order_line.price_unit, po1.company_id.currency_id, round=False) # the new price_unit is lower than th initial because of the rate's change self.assertLess(price_unit_usd_new_rate, price_unit_usd) @@ -196,7 +196,7 @@ class TestStockValuation(TransactionCase): wizard.process() # the unit price of the stock move has been updated to the latest value - self.assertEquals(move1.price_unit, price_unit_usd_new_rate) + self.assertAlmostEqual(move1.price_unit, price_unit_usd_new_rate) self.assertAlmostEqual(self.product1.stock_value, price_unit_usd_new_rate * 10, delta=0.1) @@ -407,4 +407,3 @@ class TestStockValuationWithCOA(AccountingTestCase): # check the anglo saxon entries price_diff_entry = self.env['account.move.line'].search([('account_id', '=', price_diff_account.id)]) self.assertEqual(price_diff_entry.credit, 100) -