From ef2d4f62e04c110fa6d36fa52ba4bfcc079d209f Mon Sep 17 00:00:00 2001 From: wan Date: Thu, 20 May 2021 12:25:11 +0000 Subject: [FIX] sale: use correct currency in tests The main company can have something else than EUR or USD, especialy when testing localizations. closes odoo/odoo#71098 Signed-off-by: Josse Colpaert --- 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 3a9ace87e02..b79a5ec1845 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) -- cgit v1.2.3