From 61351ec2763c85b59dcbfd44b2e6fcf6d8c54104 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Tue, 14 Jul 2020 07:24:06 +0000 Subject: [PATCH] [FIX] account: Use CoA's currency by default on testing company If a test is supposed to be run with the Belgium CoA, we expect the company is created by default with the EUR currency. Before this commit, the currency of the company was replaced by the current company's one: USD (most of the time). --- addons/account/tests/common.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/account/tests/common.py b/addons/account/tests/common.py index 0cebdeb16ee..3499c45efdc 100644 --- a/addons/account/tests/common.py +++ b/addons/account/tests/common.py @@ -814,10 +814,8 @@ class AccountTestInvoicingCommon(SavepointCase): return account chart_template = chart_template or cls.env.company.chart_template_id - currency = cls.env.user.company_id.currency_id company = cls.env['res.company'].create({ 'name': company_name, - 'currency_id': currency.id, **kwargs, }) cls.env.user.company_ids |= company @@ -825,7 +823,8 @@ class AccountTestInvoicingCommon(SavepointCase): chart_template.try_loading(company=company) # The currency could be different after the installation of the chart template. - company.write({'currency_id': kwargs.get('currency_id', currency.id)}) + if kwargs.get('currency_id'): + company.write({'currency_id': kwargs['currency_id']}) return { 'company': company,