From f5f10e2426f5402ab364318fa65e827595841de4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 7 Mar 2008 17:32:25 +0000
Subject: [PATCH] When looking for editable fields, if we the listbox is a
 proxy field, and the editable field is not found in the current form, look in
 the template field's form

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

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 384f9e794c..77d2756f5f 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -1017,6 +1017,14 @@ class ListBoxRenderer:
     editable_field_id = '%s_%s' % (self.getId(), alias)
     if form.has_field(editable_field_id, include_disabled=1):
       return form.get_field(editable_field_id, include_disabled=1)
+    
+    # if we are rendering a proxy field, also look for editable fields from the
+    # template field's form.
+    if self.field.has_value('form_id'):
+      form = getattr(self.field, self.field.get_value('form_id'), None)
+      if form and form.has_field(editable_field_id, include_disabled=1):
+        return form.get_field(editable_field_id, include_disabled=1)
+
     return None
 
   def getListMethod(self):
-- 
2.30.9