From d1d0a00176a98521747417894b7766a4627df585 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Mon, 26 May 2014 13:30:00 +0200 Subject: [PATCH] add asComposedDocument.getProperty(). that tries to get the property from the original and its effecive models. --- product/ERP5/mixin/composition.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/product/ERP5/mixin/composition.py b/product/ERP5/mixin/composition.py index 1588218c92..78fa87eaf2 100644 --- a/product/ERP5/mixin/composition.py +++ b/product/ERP5/mixin/composition.py @@ -36,6 +36,7 @@ from Products.ERP5Type.Core.Predicate import Predicate from Products.ERP5.Document.BusinessProcess import BusinessProcess from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery +_MARKER = [] @transactional_cached() def _getEffectiveModel(self, start_date, stop_date): @@ -170,6 +171,13 @@ class asComposedDocument(object): object_list) return sortValueList(object_list, sort_on, sort_order, **kw) + def getProperty(self, key, d=_MARKER, **kw): + for obj in [self._original] + self._effective_model_list: + r = obj.getProperty(key, _MARKER, **kw) + if r is not _MARKER: + return r + if d is not _MARKER: + return d class CompositionMixin: """ -- 2.30.9