From 1f07aaeef3ce82c84a91f5e2171fb804e42d5ed6 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Fri, 17 Sep 2010 06:26:30 +0000
Subject: [PATCH] Add a hack to work around a bug that CheckBoxField may not
 even try to get a property value, because it has a default value 0 in the
 field definition itself. The same hack was performed against Form.py but this
 has been disabled mistakenly for a while, because monkey-patched methods were
 overridden in ProxyField.

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

diff --git a/product/ERP5Form/ProxyField.py b/product/ERP5Form/ProxyField.py
index 79b012f71d..f2195d9bf8 100644
--- a/product/ERP5Form/ProxyField.py
+++ b/product/ERP5Form/ProxyField.py
@@ -52,7 +52,8 @@ from Acquisition import aq_base, aq_inner, aq_acquire, aq_chain
 from Products.ERP5Type.Globals import DTMLFile
 
 from Products.Formulator.TALESField import TALESMethod
-from Products.ERP5Form.Form import StaticValue, TALESValue, OverrideValue, DefaultValue, EditableValue
+from Products.ERP5Form.Form import StaticValue, TALESValue, OverrideValue, \
+        DefaultValue, EditableValue, DefaultCheckBoxValue
 from Products.ERP5Form.Form import copyMethod, isCacheable
 
 from Products.CMFCore.Skinnable import SKINDATA
@@ -682,6 +683,9 @@ class ProxyField(ZMIField):
     cacheable = isCacheable(value)
 
     if id == 'default' and field_id.startswith('my_'):
+      # XXX far from object-oriented programming
+      if template_field.meta_type == 'CheckBoxField':
+        return DefaultCheckBoxValue(field_id, value), cacheable
       return DefaultValue(field_id, value), cacheable
 
     # For the 'editable' value, we try to get a default value
-- 
2.30.9