From 80af7a0a7b2e0b36433a81812a79214617c05349 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 10 Jun 2008 12:41:32 +0000
Subject: [PATCH] Add new Property on Relation Field to change Relation Form
 Dialog

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

diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py
index d5b6282bde..9d436c8e32 100644
--- a/product/ERP5Form/MultiRelationField.py
+++ b/product/ERP5Form/MultiRelationField.py
@@ -62,7 +62,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
   local_property_names = ['update_method', 'jump_method', 'allow_jump', 
                           'base_category', 'portal_type', 'allow_creation', 
                           'container_getter_id', 'catalog_index',
-                          'relation_setter_id', 'columns', 'sort',
+                          'relation_setter_id', 'relation_form_id', 'columns', 'sort',
                           'parameter_list','list_method',
                           'first_item', 'items', 'size', 'extra_item',
                           ]
@@ -137,6 +137,13 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
                              default="",
                              required=0)
 
+  relation_form_id = fields.StringField('relation_form_id',
+                             title='Relation Form',
+                             description=(
+      "Form to display relation choices"),
+                             default="",
+                             required=0)
+
   size = fields.IntegerField('size',
                              title='Size',
                              description=(
diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py
index 8269489d4e..92ab8aba8d 100644
--- a/product/ERP5Form/SelectionTool.py
+++ b/product/ERP5Form/SelectionTool.py
@@ -1064,8 +1064,7 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
         # Field found
         field_key = field.generate_field_key()
         field_value = REQUEST.form[field_key]
-        # XXX Hardcoded form name
-        dialog_id = 'Base_viewRelatedObjectList'
+        dialog_id = field.get_value('relation_form_id') or 'Base_viewRelatedObjectList'
         redirect_form = getattr(o, dialog_id)
         # XXX Hardcoded listbox field
         selection_name = redirect_form.listbox.get_value('selection_name')
-- 
2.30.9