From 0680a972e7cc30bbd8549355d2d64870a49ba875 Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Tue, 18 May 2010 07:00:51 +0000 Subject: [PATCH] Make sure that rounding proxies can work correctly with ListBox (XXX need to write a test). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35410 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/RoundingModel.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/RoundingModel.py b/product/ERP5/Document/RoundingModel.py index 9c2ad37383..0a14375443 100644 --- a/product/ERP5/Document/RoundingModel.py +++ b/product/ERP5/Document/RoundingModel.py @@ -29,7 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import PropertySheet, Permissions from Products.ERP5.Document.Predicate import Predicate from Products.ERP5Type.Utils import UpperCase - +import ExtensionClass class RoundingModel(Predicate): """ @@ -153,6 +153,11 @@ class RoundingModel(Predicate): else: return result + # XXX not sure why but getObject may return original_document + # unless it is overridden here. + def getObject(self, *args, **kw): + return self + def __getattr__(self, name): attribute = getattr(original_document, name) if getattr(attribute, 'DUMMY_ROUNDING_METHOD_MARK', None) is DUMMY_ROUNDING_METHOD_MARK: @@ -168,7 +173,9 @@ class RoundingModel(Predicate): DUMMY_ROUNDING_METHOD_MARK = object() -class RoundingProxy(object): +# Use the Extension Class only because it is necessary to allow an instance +# of this class to be wrapped in an acquisition wrapper. +class RoundingProxy(ExtensionClass.Base): """Super class of _RoundingProxy class defined above. Use this class for isinstance method to check if object is a real instance or a rounding proxy instance. -- 2.30.9