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
This commit is contained in:
1 parent
7fbc4934a4
commit
9c6ff8c0e0
1 file changed
+2
-2
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user