From b635c76ab21e8df4cfa046e042c29ef240121371 Mon Sep 17 00:00:00 2001
From: Kevin Deldycke <kevin@nexedi.com>
Date: Sat, 22 Jul 2006 20:40:31 +0000
Subject: [PATCH] Fix bug "Entering an editable field in listbox redirects to
 the url_method of this field" (#416). Don't include error_message tag if no
 error.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8689 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/ListBox.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 7d0b6bdca9..d0a265b9e0 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -1835,6 +1835,7 @@ class ListBoxRendererLine:
       else:
         processed_value = unicode(str(processed_value), self.renderer.getEncoding())
 
+      LOG(sql, 0, str((obj.getPath(),original_value, type(original_value))))
       value_list.append((original_value, processed_value))
 
     return value_list
@@ -1967,8 +1968,12 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
         if url is None:
           html = cell_html + error_message
         else:
-          html = u'<a href="%s">%s</a> <span class="warning">%s</span>' % (url, cell_html, error_message)
-
+          if editable_field.get_value('editable'):
+            html = u'%s' % cell_html
+          else:
+            html = u'<a href="%s">%s</a>' % (url, cell_html)
+          if error_message not in ('', None):
+            html += u' <span class="warning">%s</span>' % error_message
       else:
         # If not editable, show a static text with a link, if enabled.
         processed_value = cgi.escape(processed_value)
-- 
2.30.9