From df456f579f2a1733c95d591771aeeff186fbdd14 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Mon, 7 Feb 2005 10:09:40 +0000 Subject: [PATCH] Bug fix git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2429 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/MultiRelationField.py | 41 +++++++++++--------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py index 1379bfd742..8bc2a3196e 100755 --- a/product/ERP5Form/MultiRelationField.py +++ b/product/ERP5Form/MultiRelationField.py @@ -349,30 +349,25 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField # Will be interpreted by Base_edit as "delete relation" (with no uid and value = '') if REQUEST.has_key( relation_field_id ): - # user click on the wheel: get the selection, and store the relation - if value_list == ['%']: - # we must know if user validate the form or click on the wheel button - relation_uid_list = REQUEST.get(relation_field_id, None) - if relation_uid_list != None: - relation_editor_list = [] - for i in range( len(relation_uid_list) ): - - relation_item_id = 'item_%s_%s' % ( key, i ) - relation_uid = relation_uid_list[i] - - related_object = portal_catalog.getObject(relation_uid) - if related_object is not None: - display_text = str(related_object.getProperty(catalog_index)) - else: - display_text = 'Object has been deleted' - # Check - REQUEST.set(relation_item_id, ( (display_text, relation_uid), )) - relation_editor_list.append( (i, '%', str(relation_uid), display_text) ) + # we must know if user validate the form or click on the wheel button + relation_uid_list = REQUEST.get(relation_field_id, None) + if relation_uid_list != None: + relation_editor_list = [] + for i in range( len(relation_uid_list) ): + + relation_item_id = 'item_%s_%s' % ( key, i ) + relation_uid = relation_uid_list[i] + + related_object = portal_catalog.getObject(relation_uid) + if related_object is not None: + display_text = str(related_object.getProperty(catalog_index)) + else: + display_text = 'Object has been deleted' + # Check + REQUEST.set(relation_item_id, ( (display_text, relation_uid), )) + relation_editor_list.append( (i, '%', str(relation_uid), display_text) ) - return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, relation_editor_list) - else: - # value must be define to ['%'] to see all objects in listbox - raise + return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, relation_editor_list) else: -- 2.30.9