Commit 00c8cff4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

implementation of isOrderable and isDeliverable


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@792 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da68c221
......@@ -29,7 +29,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, draft_order_state
from zLOG import LOG
......@@ -261,3 +261,12 @@ An ERP5 Rule..."""
"""
Returns a list Divergence solvers
"""
# Deliverability / orderability
def isOrderable(self, m):
return 1
def isDeliverable(self, m):
if m.getSimulationState() in draft_order_state:
return 0
return 1
......@@ -226,3 +226,11 @@ An ERP5 Rule..."""
"""
Returns a list Divergence solvers
"""
# Deliverability / orderability
def isOrderable(self, m):
return 0
def isDeliverable(self, m):
return 0
......@@ -334,8 +334,8 @@ a service in a public administration)."""
'deliverable' : self.isDeliverable(),
'variation_text' : self.getVariationText(),
'inventory' : self.getInventoriatedQuantity(),
'source_total_asset_price' : 0.0,
'destination_total_asset_price' : 0.0,
'source_asset_price' : self.getSourceAssetPrice(),
'destination_asset_price' : self.getDestinationAssetPrice(),
} ]
for m in self.objectValues():
result.extend(m.getMovementIndex())
......@@ -421,14 +421,17 @@ a service in a public administration)."""
applied_rule = self.aq_parent
rule = applied_rule.getSpecialiseValue()
if rule is not None:
return rule.isOrderable(m)
return rule.isOrderable(self)
return 0
getOrderable = isOrderable
security.declareProtected(Permissions.AccessContentsInformation, 'isDeliverable')
def isDeliverable(self):
applied_rule = self.aq_parent
rule = applied_rule.getSpecialiseValue()
if rule is not None:
return rule.isDeliverable(m)
return rule.isDeliverable(self)
return 0
getDeliverable = isDeliverable
......@@ -262,3 +262,12 @@ An ERP5 Rule..."""
"""
Returns a list Divergence solvers
"""
def isDeliverable(self, m):
resource = m.getResource()
if m.getResource() is None:
return 0
if resource.find('operation/') >= 0:
return 0
else:
return 1
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