diff --git a/product/ERP5/Document/DeliveryRule.py b/product/ERP5/Document/DeliveryRule.py index edfe7a66074960c4bfb0dfc77a089e0d379fb865..23e52fd7998a11b64e78c04ec58775157a8ea871 100755 --- a/product/ERP5/Document/DeliveryRule.py +++ b/product/ERP5/Document/DeliveryRule.py @@ -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 diff --git a/product/ERP5/Document/Rule.py b/product/ERP5/Document/Rule.py index 683e9e6cecef95c497b5798c76b092fe664b8372..6627c6222a51e616d67d0d3876c33063cb999250 100755 --- a/product/ERP5/Document/Rule.py +++ b/product/ERP5/Document/Rule.py @@ -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 + diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 6268ae561742bd1b886f9fd74119e9a98a45aaca..5131ef2e58043bd3c6bdcc72620edd5eca3a4b2a 100755 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -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 diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index 23d2d016aece497f1253efb0cd45c05f28698249..4ef45bcca7d1b7b9a6892dacdb454c24512ff4b1 100755 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -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