From db0b15e4e9ecf941c5cebba0a776050ec03599c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 3 Sep 2017 11:53:19 +0200 Subject: [PATCH] Add support for int and str on TranslateModel In Python3, those methods are not resolved using __getattr__ machinery. --- trytond/report/report.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/trytond/report/report.py b/trytond/report/report.py index 68b208bab0..5fedbf899e 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -185,7 +185,7 @@ class Report(URLMixin, PoolBase): pool = Pool() Model = pool.get(model) - class TranslateModel: + class TranslateModel(object): _languages = {} def __init__(self, id): @@ -205,6 +205,15 @@ class Report(URLMixin, PoolBase): id2record = TranslateModel._languages[self._language] record = id2record[self.id] return getattr(record, name) + + def __int__(self): + return int(self.id) + + def __str__(self): + return '%s,%s' % (Model.__name__, self.id) + + def __unicode__(self): + return u'%s,%s' % (Model.__name__, self.id) return [TranslateModel(id) for id in ids] @classmethod