[Erp5-report] r33837 jerome - /erp5/trunk/products/ERP5Form/MultiRelationField.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 18 09:43:49 CET 2010


Author: jerome
Date: Thu Mar 18 09:43:43 2010
New Revision: 33837

URL: http://svn.erp5.org?rev=33837&view=rev
Log:
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.


Modified:
    erp5/trunk/products/ERP5Form/MultiRelationField.py

Modified: erp5/trunk/products/ERP5Form/MultiRelationField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/MultiRelationField.py?rev=33837&r1=33836&r2=33837&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/MultiRelationField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/MultiRelationField.py [utf8] Thu Mar 18 09:43:43 2010
@@ -406,7 +406,6 @@
     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 @@
                 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:




More information about the Erp5-report mailing list