From b9a006c1c02a06cf3cd34828860125e6d6aa3fb4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 6 Jun 2016 13:05:19 +0200 Subject: [PATCH] [FIX] account: Exchange test failing on Jun 6 The test `test_balanced_exchanges_gain_loss` failed on Jun 6, because it created a specific rate for today's date at midnight (e.g. on Jun 6, 201x-06-06 00:00:00) for the test purpose, but a rate is created in the demo data for Jun 6 midnight exactly: `base.rateUSDbis`, making the test confused about which rate to use. We solve this by making the test use the rate `base.rateUSDbis`, modifying the rate for its own need, instead of creating a new rate. --- addons/account/tests/test_reconciliation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 767b4f77edc..fd33ff96ffa 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -183,9 +183,9 @@ class TestReconciliation(TransactionCase): # will lead to an exchange loss, that should be handled correctly within the journal items. cr, uid = self.cr, self.uid # We update the currency rate of the currency USD in order to force the gain/loss exchanges in next steps - self.res_currency_rate_model.create(cr, uid, { + rateUSDbis_id = self.registry("ir.model.data").get_object_reference(self.cr, self.uid, "base", "rateUSDbis")[1] + self.res_currency_rate_model.write(cr, uid, rateUSDbis_id, { 'name': time.strftime('%Y-%m-%d') + ' 00:00:00', - 'currency_id': self.currency_usd_id, 'rate': 0.033, }) # We create a customer invoice of 2.00 USD