summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2018-07-19 13:35:27 +0200
committerXavier Morel <xmo@odoo.com>2018-07-19 13:37:10 +0200
commit9f8eae34d1d89d7cf01eef8a1a89dc431ef5f4e2 (patch)
treeaea6469290c6969d941c729e47b6722781ef51db /odoo/tools
parentbc12428e174dcba94d86e855cbeba0e77da9b747 (diff)
[FIX] undefined variables (potential nameerror)
Backport 9ec0455abc041b855dcab18e8e185baf806b9f14 and 6a601fe6dc848cdeca2ab8429210e3b5087275d9 as they fixed various possible NameError but did so in later sub-releases.
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/misc.py2
-rw-r--r--odoo/tools/pycompat.py2
-rw-r--r--odoo/tools/xml_utils.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py
index 2f43c58e02d..17518ce1525 100644
--- a/odoo/tools/misc.py
+++ b/odoo/tools/misc.py
@@ -1069,7 +1069,7 @@ def formatLang(env, value, digits=None, grouping=True, monetary=False, dp=False,
digits = decimal_precision_obj.precision_get(dp)
elif currency_obj:
digits = currency_obj.decimal_places
- elif (hasattr(value, '_field') and isinstance(value._field, (float_field, function_field)) and value._field.digits):
+ elif (hasattr(value, '_field') and getattr(value._field, 'digits', None)):
digits = value._field.digits[1]
if not digits and digits is not 0:
digits = DEFAULT_DIGITS
diff --git a/odoo/tools/pycompat.py b/odoo/tools/pycompat.py
index 14195c4fa79..5f25e23e977 100644
--- a/odoo/tools/pycompat.py
+++ b/odoo/tools/pycompat.py
@@ -13,7 +13,7 @@ PY2 = sys.version_info[0] == 2
_Writer = collections.namedtuple('_Writer', 'writerow writerows')
if PY2:
- # pylint: disable=long-builtin,unichr-builtin,unicode-builtin
+ # pylint: disable=long-builtin,unichr-builtin,unicode-builtin,undefined-variable
unichr = unichr
text_type = unicode
string_types = (str, unicode)
diff --git a/odoo/tools/xml_utils.py b/odoo/tools/xml_utils.py
index 864f1ce0caa..eb5b8b203bf 100644
--- a/odoo/tools/xml_utils.py
+++ b/odoo/tools/xml_utils.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from lxml import etree
from odoo.tools.misc import file_open
-
+from odoo.exceptions import UserError
def check_with_xsd(tree_or_str, stream):
raise UserError("Method 'check_with_xsd' deprecated ")