changeset 20c2b318b42f in modules/product:default
details: https://hg.tryton.org/modules/product?cmd=changeset&node=20c2b318b42f
description:
        Support Reference fields in get_template

        issue10680
        review346831002
diffstat:

 product.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r f74e3a5ca542 -r 20c2b318b42f product.py
--- a/product.py        Mon Aug 30 00:27:13 2021 +0200
+++ b/product.py        Mon Aug 30 23:58:28 2021 +0200
@@ -454,6 +454,9 @@
     def get_template(self, name):
         value = getattr(self.template, name)
         if isinstance(value, Model):
+            field = getattr(self.__class__, name)
+            if field._type == 'reference':
+                return str(value)
             return value.id
         elif (isinstance(value, (list, tuple))
                 and value and isinstance(value[0], Model)):

Reply via email to