diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py index 4b46a7263a34f69b6854527eb373a0a0d1b7864d..73c8e0bb39be023da748fa1640d6d77453ace11c 100755 --- a/product/ERP5Form/MultiRelationField.py +++ b/product/ERP5Form/MultiRelationField.py @@ -411,7 +411,11 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField if relation_uid not in (None, ''): # A value has been defined by the user in popup menu if type(relation_uid) in (type([]), type(())): relation_uid = relation_uid[0] - related_object = portal_catalog.getObject(relation_uid) + try: + related_object = portal_catalog.getObject(relation_uid) + except ValueError: + # Catch the exception raised when the uid is a string + related_object = None if related_object is not None: display_text = str(related_object.getProperty(catalog_index)) else: diff --git a/product/ERP5Form/RelationField.py b/product/ERP5Form/RelationField.py index 3f38b17212abd774b7b60679fb186c1f08ed460b..a6475d40f46d2a9b53a0906b18db41309e6a316a 100755 --- a/product/ERP5Form/RelationField.py +++ b/product/ERP5Form/RelationField.py @@ -350,7 +350,11 @@ class RelationStringFieldValidator(Validator.StringValidator): else: relation_uid = relation_uid[0] - related_object = portal_catalog.getObject(relation_uid) + try: + related_object = portal_catalog.getObject(relation_uid) + except ValueError: + # Catch the error raised when the uid is a string + related_object = None if related_object is not None: display_text = str(related_object.getProperty(catalog_index)) else: