Commit 9e437721 authored by Jérome Perrin's avatar Jérome Perrin

Stop using immediate_reindex=1 when creating a document.

Pass the list of objects instead or the list of uids to relation_setter_id
method, otherwise it can not work with newly created objects, as they will not
be indexed.
This is incompatible API change, and scripts used for relation_setter_id have to be updated.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33837 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6cbd0a76
......@@ -406,7 +406,6 @@ class MultiRelationEditor:
def edit(self, o):
if self.relation_editor_list != None:
relation_uid_list = []
relation_object_list = []
for value, uid, display_text, relation_key, item_key in \
self.relation_editor_list:
......@@ -426,22 +425,19 @@ class MultiRelationEditor:
kw ={}
kw[self.key] = value.replace('%', '')
kw['portal_type'] = portal_type
kw['immediate_reindex'] = 1
new_object = portal_module_object.newContent(**kw)
uid = new_object.getUid()
relation_object_list.append(new_object)
else:
raise
relation_uid_list.append(int(uid))
relation_object_list.append( o.portal_catalog.getObject(uid))
raise
else:
relation_object_list.append(o.portal_catalog.getObject(uid))
# Edit relation
if self.relation_setter_id:
relation_setter = getattr(o, self.relation_setter_id)
relation_setter((), portal_type=self.portal_type_list)
relation_setter(relation_uid_list, # relation setter is uid based
portal_type=self.portal_type_list) # maybe not the best solution
# and inconsistent with bellow
relation_setter(relation_object_list,
portal_type=self.portal_type_list)
else:
# we could call a generic method which create the setter method name
if len(relation_object_list) == 1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment