From 095818d477b015dfc18c1482b04f397da2f6c81f Mon Sep 17 00:00:00 2001 From: wan Date: Thu, 20 May 2021 12:25:11 +0000 Subject: [PATCH] [FIX] sale: use correct currency in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main company can have something else than EUR or USD, especialy when testing localizations. closes odoo/odoo#71171 X-original-commit: 91a3dca13c1de637b25810ed7f509dce6e66c908 Signed-off-by: Josse Colpaert Signed-off-by: William André (wan) --- addons/sale/tests/test_sale_order.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/sale/tests/test_sale_order.py b/addons/sale/tests/test_sale_order.py index 4f7ce2f4fd4..bc613d79510 100644 --- a/addons/sale/tests/test_sale_order.py +++ b/addons/sale/tests/test_sale_order.py @@ -375,7 +375,8 @@ class TestSaleOrder(TestSaleCommon): # Make sure the company is in USD main_company = self.env.ref('base.main_company') main_curr = main_company.currency_id - other_curr = (self.env.ref('base.USD') + self.env.ref('base.EUR')) - main_curr + current_curr = self.env.company.currency_id + other_curr = self.currency_data['currency'] # main_company.currency_id = other_curr # product.currency_id when no company_id set other_company = self.env["res.company"].create({ "name": "Test", @@ -401,8 +402,8 @@ class TestSaleOrder(TestSaleCommon): self.assertEqual(product_1.currency_id, main_curr) self.assertEqual(product_2.currency_id, main_curr) - self.assertEqual(product_1.cost_currency_id, main_curr) - self.assertEqual(product_2.cost_currency_id, main_curr) + self.assertEqual(product_1.cost_currency_id, current_curr) + self.assertEqual(product_2.cost_currency_id, current_curr) product_1_ctxt = product_1.with_user(user_in_other_company) product_2_ctxt = product_2.with_user(user_in_other_company)