From 7d085af3d20684ef5478dacb0edda5e99c566e21 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Wed, 16 Feb 2005 10:35:17 +0000
Subject: [PATCH] Enable possibility to validate the relation by clicking on
 the wheel without value in the field.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2477 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/MultiRelationField.py | 5 ++++-
 product/ERP5Form/RelationField.py      | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py
index 0ca8dc1d44..68da5eae93 100755
--- a/product/ERP5Form/MultiRelationField.py
+++ b/product/ERP5Form/MultiRelationField.py
@@ -342,7 +342,10 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator,  RelationField
       catalog_index = field.get_value('catalog_index')
       relation_setter_id = field.get_value('relation_setter_id')
 
-      if checkSameKeys( value_list, current_value_list ):
+      relation_field_id = 'relation_%s' % ( key )      
+      # we must know if user validate the form or click on the wheel button
+      relation_uid_list = REQUEST.get(relation_field_id, None)
+      if checkSameKeys( value_list, current_value_list ) and (relation_uid_list is None):
         # XXX Will be interpreted by Base_edit as "do nothing"
         #return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, None)
         return None
diff --git a/product/ERP5Form/RelationField.py b/product/ERP5Form/RelationField.py
index 76ff676883..8802d0a84c 100755
--- a/product/ERP5Form/RelationField.py
+++ b/product/ERP5Form/RelationField.py
@@ -316,7 +316,8 @@ class RelationStringFieldValidator(Validator.StringValidator):
       parameter_list = field.get_value('parameter_list')
       relation_setter_id = field.get_value('relation_setter_id')
 
-      if value == current_value:
+      if (value == current_value) and (relation_uid is None):
+        LOG('RelationStringFieldValidator, validate',0,'Same value, but relation_uid: %s' % str(relation_uid) )
         return None
 # XXX        return RelationEditor(key, base_category, portal_type, None, 
 #                              portal_type_item, catalog_index, value, relation_setter_id, None)
-- 
2.30.9