Commit 40f6e36a authored by Romain Courteaud's avatar Romain Courteaud

Remove workflow methods.

Many methods have to be deleted, but are now kept for compatibility.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3154 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 460fadc0
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002, 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com> # Jean-Paul Smets-Solanes <jp@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
...@@ -32,20 +33,21 @@ from Products.CMFCore.WorkflowCore import WorkflowMethod ...@@ -32,20 +33,21 @@ from Products.CMFCore.WorkflowCore import WorkflowMethod
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.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.XMLMatrix import TempXMLMatrix
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5.Document.DeliveryCell import DeliveryCell from Products.ERP5.Document.DeliveryCell import DeliveryCell
from Acquisition import Explicit, Implicit from Acquisition import Explicit, Implicit
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
from DateTime import DateTime from DateTime import DateTime
#from Products.ERP5.ERP5Globals import movement_type_list, draft_order_state, planned_order_state
# XXX FIXME: to be deleted
from Products.ERP5Type.XMLMatrix import TempXMLMatrix
from Products.ERP5.MovementGroup import OrderMovementGroup, PathMovementGroup from Products.ERP5.MovementGroup import OrderMovementGroup, PathMovementGroup
from Products.ERP5.MovementGroup import DateMovementGroup, ResourceMovementGroup from Products.ERP5.MovementGroup import DateMovementGroup, ResourceMovementGroup
from Products.ERP5.MovementGroup import VariantMovementGroup, RootMovementGroup from Products.ERP5.MovementGroup import VariantMovementGroup, RootMovementGroup
from zLOG import LOG from zLOG import LOG
# XXX FIXME: to be deleted
class TempDeliveryCell(DeliveryCell): class TempDeliveryCell(DeliveryCell):
def getPrice(self): def getPrice(self):
...@@ -66,6 +68,7 @@ class TempDeliveryCell(DeliveryCell): ...@@ -66,6 +68,7 @@ class TempDeliveryCell(DeliveryCell):
def activate(self): def activate(self):
return self return self
# XXX FIXME: to be deleted
class XMLMatrix(TempXMLMatrix): class XMLMatrix(TempXMLMatrix):
def newCellContent(self, id,**kw): def newCellContent(self, id,**kw):
...@@ -76,6 +79,7 @@ class XMLMatrix(TempXMLMatrix): ...@@ -76,6 +79,7 @@ class XMLMatrix(TempXMLMatrix):
self._setObject(id, new_temp_object) self._setObject(id, new_temp_object)
return self.get(id) return self.get(id)
# XXX FIXME: to be deleted
class Group(Implicit): class Group(Implicit):
""" """
Hold movements which have the same resource and the same variation. Hold movements which have the same resource and the same variation.
...@@ -260,78 +264,7 @@ class Delivery(XMLObject): ...@@ -260,78 +264,7 @@ class Delivery(XMLObject):
""" """
return 1 return 1
security.declareProtected(Permissions.ModifyPortalContent, 'plan') # XXX FIXME: to be deleted
def plan(self):
"""
Sets the delivery to planned
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
plan = WorkflowMethod(plan)
security.declareProtected(Permissions.ModifyPortalContent, 'confirm')
def confirm(self):
"""
Sets the order to confirmed
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
confirm = WorkflowMethod(confirm)
security.declareProtected(Permissions.ModifyPortalContent, 'start')
def start(self):
"""
Starts the delivery
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
start = WorkflowMethod(start)
security.declareProtected(Permissions.ModifyPortalContent, 'stop')
def stop(self):
"""
Stops the delivery
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
stop = WorkflowMethod(stop)
security.declareProtected(Permissions.ModifyPortalContent, 'deliver')
def deliver(self):
"""
Deliver the delivery
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
deliver = WorkflowMethod(deliver)
security.declareProtected(Permissions.ModifyPortalContent, 'cancel')
def cancel(self):
"""
Deliver the delivery
"""
# NEW: we never rexpand simulation - This is a task for DSolver / TSolver
# self.applyToDeliveryRelatedMovement(method_id = 'expand')
cancel = WorkflowMethod(cancel)
security.declareProtected(Permissions.ModifyPortalContent, '_invoice')
def _invoice(self):
"""
This method is called whenever a packing list is being invoiced
"""
# We will make sure that everything is well generated into the
# simulation, then we will be able to buid the invoice list.
# we create an invoice for this delivery
self.activate(priority=4).buildInvoiceList()
invoice = WorkflowMethod(_invoice, 'invoice')
security.declareProtected(Permissions.ModifyPortalContent, 'buildInvoiceList') security.declareProtected(Permissions.ModifyPortalContent, 'buildInvoiceList')
def buildInvoiceList(self): def buildInvoiceList(self):
""" """
...@@ -518,19 +451,6 @@ class Delivery(XMLObject): ...@@ -518,19 +451,6 @@ class Delivery(XMLObject):
def _getDestinationTotalPrice(self, context): def _getDestinationTotalPrice(self, context):
return 5.0 return 5.0
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice')
def getTotalPrice(self):
"""
"""
result = self.z_total_price(explanation_uid = self.getUid())
return result[0][0]
# security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice')
# def getTotalPrice(self, context=None, REQUEST=None, **kw):
# """
# """
# return self._getTotalPrice(self.asContext(context=context, REQUEST=REQUEST, **kw))
security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultTotalPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultTotalPrice')
def getDefaultTotalPrice(self, context=None, REQUEST=None, **kw): def getDefaultTotalPrice(self, context=None, REQUEST=None, **kw):
""" """
...@@ -603,8 +523,9 @@ class Delivery(XMLObject): ...@@ -603,8 +523,9 @@ class Delivery(XMLObject):
def getDelivery(self): def getDelivery(self):
return self.getRelativeUrl() return self.getRelativeUrl()
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementList') security.declareProtected(Permissions.AccessContentsInformation,
def getMovementList(self, portal_type=None): 'getMovementList')
def getMovementList(self, portal_type=None, **kw):
""" """
Return a list of movements. Return a list of movements.
""" """
...@@ -671,7 +592,7 @@ class Delivery(XMLObject): ...@@ -671,7 +592,7 @@ class Delivery(XMLObject):
""" """
Returns 0 if the target is not met Returns 0 if the target is not met
""" """
return not self.isDivergent() return int(not self.isDivergent())
security.declareProtected(Permissions.View, 'isSimulated') security.declareProtected(Permissions.View, 'isSimulated')
def isSimulated(self): def isSimulated(self):
...@@ -712,15 +633,6 @@ class Delivery(XMLObject): ...@@ -712,15 +633,6 @@ class Delivery(XMLObject):
return 1 return 1
return 0 return 0
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, dsolver, tsolver):
"""
Solves a delivery with a Solver
Only delivery level matter should be modified (not movements)
"""
dsolver.solveDelivery(self)
tsolver.solveDelivery(self)
####################################################### #######################################################
# Defer indexing process # Defer indexing process
def reindexObject(self, *k, **kw): def reindexObject(self, *k, **kw):
...@@ -882,6 +794,7 @@ class Delivery(XMLObject): ...@@ -882,6 +794,7 @@ class Delivery(XMLObject):
return self.portal_simulation.getMovementHistoryStat(**kw) return self.portal_simulation.getMovementHistoryStat(**kw)
# XXX FIXME: to be deleted
security.declareProtected(Permissions.AccessContentsInformation, 'collectMovement') security.declareProtected(Permissions.AccessContentsInformation, 'collectMovement')
def collectMovement(self, movement_list): def collectMovement(self, movement_list):
""" """
...@@ -907,7 +820,7 @@ class Delivery(XMLObject): ...@@ -907,7 +820,7 @@ class Delivery(XMLObject):
return group_list return group_list
# XXX this should be moved to Invoice # XXX FIXME: to be deleted
security.declareProtected(Permissions.AccessContentsInformation, 'buildInvoiceLineList') security.declareProtected(Permissions.AccessContentsInformation, 'buildInvoiceLineList')
def buildInvoiceLineList(self, movement_group): def buildInvoiceLineList(self, movement_group):
""" """
...@@ -967,6 +880,7 @@ class Delivery(XMLObject): ...@@ -967,6 +880,7 @@ class Delivery(XMLObject):
return invoice_line_list return invoice_line_list
# XXX FIXME: to be deleted
# Simulation consistency propagation # Simulation consistency propagation
security.declareProtected(Permissions.ModifyPortalContent, 'updateFromSimulation') security.declareProtected(Permissions.ModifyPortalContent, 'updateFromSimulation')
def updateFromSimulation(self, update_target = 0): def updateFromSimulation(self, update_target = 0):
...@@ -1037,6 +951,7 @@ class Delivery(XMLObject): ...@@ -1037,6 +951,7 @@ class Delivery(XMLObject):
# Touch the Transaction to make an automatic converge # Touch the Transaction to make an automatic converge
self.edit() self.edit()
# XXX FIXME: to be deleted
security.declareProtected(Permissions.ModifyPortalContent, 'propagateResourceToSimulation') security.declareProtected(Permissions.ModifyPortalContent, 'propagateResourceToSimulation')
def propagateResourceToSimulation(self): def propagateResourceToSimulation(self):
""" """
...@@ -1093,6 +1008,7 @@ class Delivery(XMLObject): ...@@ -1093,6 +1008,7 @@ class Delivery(XMLObject):
LOG('propagateResourceToSimulation, list_to_merge:',0,list_to_merge) LOG('propagateResourceToSimulation, list_to_merge:',0,list_to_merge)
self.portal_simulation.mergeDeliveryList(list_to_merge) self.portal_simulation.mergeDeliveryList(list_to_merge)
# XXX FIXME: to be deleted
security.declareProtected(Permissions.ModifyPortalContent, 'propagateArrowToSimulation') security.declareProtected(Permissions.ModifyPortalContent, 'propagateArrowToSimulation')
def propagateArrowToSimulation(self): def propagateArrowToSimulation(self):
""" """
...@@ -1154,6 +1070,7 @@ class Delivery(XMLObject): ...@@ -1154,6 +1070,7 @@ class Delivery(XMLObject):
pass pass
notifySimulationChange = WorkflowMethod(notifySimulationChange) notifySimulationChange = WorkflowMethod(notifySimulationChange)
# XXX FIXME: to be deleted
def updateSimulationDeliveryProperties(self, movement_list = None, delivery = None): def updateSimulationDeliveryProperties(self, movement_list = None, delivery = None):
""" """
Set properties delivery_ratio and delivery_error for each simulation movement Set properties delivery_ratio and delivery_error for each simulation movement
......
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