summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Taferner <wtaferner@users.noreply.github.com>2017-09-10 07:28:49 +0200
committerXavier Morel <xmo@odoo.com>2017-09-12 11:20:09 +0200
commit236a24de964d4fb4cdcab9bc2f43f29b2bbe47fe (patch)
tree1e29972e8c0a9c2a54f39e449c941498e8c23974
parent80ad2a370cb161b205c7fd07a97f577a07fc50b0 (diff)
[FIX] account: handling of text domains in _query_get
1df72cb01b9c6de0e417bdafb60b46d0276b7888 added a stringification of the domain parameter to handle situations where an actual domain (list/tuple) is being provided rather than a string, however this causes issues when the string input is text (unicode) containing non-ascii data as in Python 2 `str()` will then raise a UnicodeEncodeError. Rather than stringify the input, bypass safe_eval when the input is already a proper domain. Closes #19367
-rw-r--r--addons/account/models/account_move.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 15c69fe3d53..4458152f940 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -1292,7 +1292,9 @@ class AccountMoveLine(models.Model):
@api.model
def _query_get(self, domain=None):
context = dict(self._context or {})
- domain = domain and safe_eval(str(domain)) or []
+ domain = domain or []
+ if not isinstance(domain, (list, tuple)):
+ domain = safe_eval(domain)
date_field = 'date'
if context.get('aged_balance'):