From 236a24de964d4fb4cdcab9bc2f43f29b2bbe47fe Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Sun, 10 Sep 2017 07:28:49 +0200 Subject: [PATCH] [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 --- addons/account/models/account_move.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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'):