Commit 00215e94 authored by Romain Courteaud's avatar Romain Courteaud

Try to remove flushActivity.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2900 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 798ee56e
...@@ -117,40 +117,48 @@ class Order(Delivery): ...@@ -117,40 +117,48 @@ class Order(Delivery):
# Make sure there is exactly one applied rule # Make sure there is exactly one applied rule
my_applied_rule_list = self.getCausalityRelatedValueList( \ my_applied_rule_list = self.getCausalityRelatedValueList( \
portal_type='Applied Rule') portal_type='Applied Rule')
if len(my_applied_rule_list) != 1: if len(my_applied_rule_list)==0:
# Make sure we have an order rule # Make sure we have an order rule
self._createOrderRule() self._createOrderRule()
# Make sure there is exactly one applied rule
my_applied_rule_list = self.getCausalityRelatedValueList( \ my_applied_rule_list = self.getCausalityRelatedValueList( \
portal_type='Applied Rule') portal_type='Applied Rule')
if len(my_applied_rule_list) != 1: elif len(my_applied_rule_list)>1:
# XXX This is an error raise SimulationError, 'Order %s has more than one applied rule.' %\
raise CategoryError, "Order has no or too many order rule(s)" self.getRelativeUrl()
applied_rule = my_applied_rule_list[0].getObject() applied_rule = my_applied_rule_list[0].getObject()
if applied_rule is None: if applied_rule is None:
# XXX This is an error # XXX This is an error
raise CategoryError, "Order has None order rule" raise SimulationError, "Order %s has None order rule" %\
self.getRelativeUrl()
# Make sure applied rule has been reindexed # Make sure applied rule has been reindexed
applied_rule.immediateReindexObject()
# Make sure there are no more activities on this order related to expand # Make sure there are no more activities on this order related to expand
self.flushActivity(invoke=0, method_id='expand') # XXX do not use flushActivity anymore ! So, call expand to be sure...
# self.flushActivity(invoke=0, method_id='expand')
# Make sure expand is finished # Make sure expand is finished
# We are expanding but are not allowed to if state wrong... # We are expanding but are not allowed to if state wrong...
# (ex. confirmed) # (ex. confirmed)
applied_rule.expand(force = 1) # applied_rule.expand(force = 1)
applied_rule.expand()
# thus, we mist force expand of applied order rule # thus, we mist force expand of applied order rule
applied_rule.flushActivity(invoke=1) # applied_rule.flushActivity(invoke=1)
# Build delivery list on applied rule # Make sure applied rule has been reindexed
# Currently, we build it 'again' but we should actually only build applied_rule.recursiveImmediateReindexObject()
# deliveries for orphaned movements
if self.getPortalType() == 'Production Order' : # # Build delivery list on applied rule
delivery_list = self.ProductionOrder_buildDeliveryList() # # Currently, we build it 'again' but we should actually only build
# Coramy specific moved to portal_simulation # # deliveries for orphaned movements
#else: # if self.getPortalType() == 'Production Order' :
elif self.getPortalType() in ('Purchase Order', 'Sale Order') : # delivery_list = self.ProductionOrder_buildDeliveryList()
delivery_list = self.Order_createPackingList() # # Coramy specific moved to portal_simulation
# Coramy specific should be moved to portal_simulation # #else:
#self.informDeliveryList(delivery_list=delivery_list, # elif self.getPortalType() in ('Purchase Order', 'Sale Order') :
# comment=repr(delivery_list)) # XXX Not ready # delivery_list = self.Order_createPackingList()
# # Coramy specific should be moved to portal_simulation
# #self.informDeliveryList(delivery_list=delivery_list,
# # comment=repr(delivery_list)) # XXX Not ready
def applyToOrderRelatedMovement(self, portal_type='Simulation Movement', \ def applyToOrderRelatedMovement(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