From 93bb6f322d0bccbca5106ae5cf67ee26e02d0da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Thu, 9 Mar 2017 10:12:56 -0600 Subject: [PATCH] [FIX] base: avoid variable referenced before assignment error If the company currency is not active (that should not happen but nothing prevents it, probably happening with some CoA installation), the variable company_currency_format is undefined and an error is raised. Closes #15799 --- odoo/addons/base/res/res_currency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/res/res_currency.py b/odoo/addons/base/res/res_currency.py index 5c91e55b3f0..aef7bb97866 100644 --- a/odoo/addons/base/res/res_currency.py +++ b/odoo/addons/base/res/res_currency.py @@ -177,7 +177,7 @@ class Currency(models.Model): function += "if (arguments[1] === %s) { %s }" % (currency.id, return_str) if (currency == company_currency): company_currency_format = return_str - function = "if (arguments[1] === false || arguments[1] === undefined) {" + company_currency_format + " }" + function + function = "if (arguments[1] === false || arguments[1] === undefined) {" + company_currency_format + " }" + function return function def _select_companies_rates(self):