diff --git a/product/ERP5Type/Core/ActionInformation.py b/product/ERP5Type/Core/ActionInformation.py index 31d012fe4f01343235513bfb4b15252b52bb06d4..e0bfcdada16d6f9950135b105ab57eff7574579c 100644 --- a/product/ERP5Type/Core/ActionInformation.py +++ b/product/ERP5Type/Core/ActionInformation.py @@ -120,22 +120,22 @@ class ActionInformation(XMLObject): value = value and Expression(value) or None self._baseSetIcon(value) -# def getAction(self): -# """Overridden getter for 'action' to clean null values""" -# if getattr(aq_base(self), 'action', None) == '': -# del self.action -# return self._baseGetAction() -# -# def getCondition(self): -# """Overridden getter for 'condition' to clean null values""" -# if getattr(aq_base(self), 'condition', None) == '': -# del self.condition -# return self._baseGetCondition() -# + def getAction(self): + """Overridden getter for 'action' to clean null values""" + if getattr(aq_base(self), 'action', None) == '': + del self.action + return self._baseGetAction() + + def getCondition(self): + """Overridden getter for 'condition' to clean null values""" + if getattr(aq_base(self), 'condition', None) == '': + del self.condition + return self._baseGetCondition() + def getIcon(self): - """Explicit getter for 'icon' to override DynamicType.getIcon from CMF""" -# if getattr(aq_base(self), 'icon', None) == '': -# del self.icon + """Overridden getter for 'icon' to clean null values""" + if getattr(aq_base(self), 'icon', None) == '': + del self.icon return self._baseGetIcon() security.declareProtected(AccessContentsInformation, 'getActionText') diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 2bdfe89ebafe08d7cb9da3b45b3bc185577f0614..8315b864e1d6e80103c873ef5f13b6a349145afd 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -488,6 +488,8 @@ class ERP5TypeInformation(XMLObject, security.declarePrivate('getDefaultViewFor') def getDefaultViewFor(self, ob, view='view'): + """Return the object that renders the default view for the given object + """ ec = createExpressionContext(ob) best_action = (), None for action in self.getFilteredActionListFor(ob): @@ -619,7 +621,7 @@ class ERP5TypeInformation(XMLObject, action = ActionInformation(self.generateNewId()) for k, v in old_action.iteritems(): if k in ('action', 'condition', 'icon'): - if not v or not v.text: + if not v: continue v = v.__class__(v.text) setattr(action, {'id': 'reference',