[Erp5-report] r15837 - /erp5/trunk/products/ERP5/Document/OrderLine.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Aug 27 15:13:27 CEST 2007
Author: jp
Date: Mon Aug 27 15:13:27 2007
New Revision: 15837
URL: http://svn.erp5.org?rev=15837&view=rev
Log:
Initial implementation of hierarchical orders.
Modified:
erp5/trunk/products/ERP5/Document/OrderLine.py
Modified: erp5/trunk/products/ERP5/Document/OrderLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderLine.py?rev=15837&r1=15836&r2=15837&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderLine.py (original)
+++ erp5/trunk/products/ERP5/Document/OrderLine.py Mon Aug 27 15:13:27 2007
@@ -30,8 +30,11 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
+from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5.Document.Movement import Movement
+
+from zLOG import LOG
class OrderLine(DeliveryLine):
"""
@@ -61,6 +64,22 @@
# Declarative interfaces
__implements__ = ( Interface.Variated, )
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'hasLineContent')
+ def hasLineContent(self):
+ """Return true if the object contains lines.
+ We cache results in a volatile variable.
+ """
+ acquisition_key = ('hasLineContent', self.getPath())
+ transactional_variable = getTransactionalVariable(acquisition_key)
+ try:
+ result = transactional_variable['hasLineContent']
+ except KeyError:
+ result = (len(self.contentValues(meta_type=self.meta_type)) > 0)
+ transactional_variable['hasLineContent'] = result
+ LOG('hasLineContent', 0, '%s %s' % (acquisition_key, result))
+ return result
def applyToOrderLineRelatedMovement(self, portal_type='Simulation Movement',
method_id = 'expand'):
More information about the Erp5-report
mailing list