From 9c6ff8c0e0ae43699ef375deaa2ebdbd58a74e96 Mon Sep 17 00:00:00 2001 From: Ralf Peschke Date: Sat, 13 Apr 2013 11:07:33 +0200 Subject: [PATCH] Use value instead of record instance on import_data Importing records with m2o- and m2m-relations import_data gives record instances to the create-method of the object instead of record-id's. Creating the same object using the GUI the client gives record-id's. On error the record-instances can't be serialized by JSON and the common error "500 internal server error" will be reported to the client issue3124 review767002 --- trytond/model/modelstorage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index f6a39bbf31..dfab5ccb13 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -566,7 +566,7 @@ class ModelStorage(Model): warn('too_many_relations_found', value, relation) res = None else: - res = res[0] + res = res[0].id return res def get_many2many(relation, value): @@ -586,7 +586,7 @@ class ModelStorage(Model): else: res.extend(res2) if len(res): - res = [('set', res)] + res = [('set', [x.id for x in res])] return res def get_one2one(relation, value):