Support Reference fields in get_template

issue10680
review346831002
This commit is contained in:
Jared Esparza committed 2021-08-30 23:58:28 +02:00
1 parent 12a7c6f617
commit 734ff69333
1 file changed
+3
+3
View File
@@ -454,6 +454,9 @@ class Product(
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)):