Commit 74313bd7 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Initial implementation of hierarchical orders.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15837 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7aefe2ed
...@@ -30,9 +30,12 @@ from Globals import InitializeClass, PersistentMapping ...@@ -30,9 +30,12 @@ from Globals import InitializeClass, PersistentMapping
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface 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.DeliveryLine import DeliveryLine
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
from zLOG import LOG
class OrderLine(DeliveryLine): class OrderLine(DeliveryLine):
""" """
A order line defines quantity and price A order line defines quantity and price
...@@ -62,6 +65,22 @@ class OrderLine(DeliveryLine): ...@@ -62,6 +65,22 @@ class OrderLine(DeliveryLine):
# Declarative interfaces # Declarative interfaces
__implements__ = ( Interface.Variated, ) __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', def applyToOrderLineRelatedMovement(self, portal_type='Simulation Movement',
method_id = 'expand'): method_id = 'expand'):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment