changeset 672717d741c2 in trytond:4.2
details: https://hg.tryton.org/trytond?cmd=changeset;node=672717d741c2
description:
Take the field type from the right definition
The field type should be taken from the current fields definition and
not from
the class.
issue8212
review273131002
(grafted from 8d9fe8efe6ecd243923da4862b5dd8dd83d522a3)
diffstat:
trytond/model/modelstorage.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (26 lines):
diff -r 3f73760b4901 -r 672717d741c2 trytond/model/modelstorage.py
--- a/trytond/model/modelstorage.py Fri Mar 22 18:18:36 2019 +0100
+++ b/trytond/model/modelstorage.py Fri Mar 22 18:25:52 2019 +0100
@@ -670,11 +670,10 @@
return res
@memoize(1000)
- def get_by_id(value, field):
+ def get_by_id(value, field, ftype):
if not value:
return None
relation = None
- ftype = fields_def[field[-1][:-3]]['type']
if ftype == 'many2many':
value = csv.reader(value.splitlines(), delimiter=',',
quoting=csv.QUOTE_NONE, escapechar='\\').next()
@@ -717,7 +716,8 @@
is_prefix_len = (len(field) == (prefix_len + 1))
value = line[i]
if is_prefix_len and field[-1].endswith(':id'):
- row[field[0][:-3]] = get_by_id(value, field)
+ ftype = fields_def[field[-1][:-3]]['type']
+ row[field[0][:-3]] = get_by_id(value, field, ftype)
elif is_prefix_len and ':lang=' in field[-1]:
field_name, lang = field[-1].split(':lang=')
translate.setdefault(lang, {})[field_name] = value or False