Commit 11906fae authored by Sebastien Robin's avatar Sebastien Robin

remove an unused line


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3768 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b0940ab4
......@@ -253,7 +253,7 @@ class Delivery(XMLObject):
return 1
security.declareProtected(Permissions.View, 'isDivergent')
def isDivergent(self,fast=0,**kw):
def isDivergent(self,**kw):
"""
Returns 1 if the target is not met according to the current information
After and edit, the isOutOfTarget will be checked. If it is 1,
......@@ -264,13 +264,15 @@ class Delivery(XMLObject):
# Delivery_zIsDivergent only works when object and simulation is
# reindexed, so if an user change the delivery, he must wait
# until everything is indexed, this is not acceptable for users
# So the user should be warned with a state of calcul
# so we should not use it by default (and may be we should remove)
if fast==1 and len(self.Delivery_zIsDivergent(uid=self.getUid())) > 0:
if len(self.Delivery_zIsDivergent(uid=self.getUid())) > 0:
return 1
# Check if the total quantity equals the total of each simulation movement quantity
for movement in self.getMovementList():
if movement.isDivergent():
return 1
# This should not be used because this is too slow
#for movement in self.getMovementList():
# if movement.isDivergent():
# return 1
return 0
#######################################################
......
......@@ -202,8 +202,11 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
emit targetUnreachable !
"""
LOG('Line.isDivergent, self.getPath',0,self.getPath())
if self.hasCellContent():
for cell in self.contentValues(filter={'portal_type': 'Delivery Cell'}):
LOG('Line.isDivergent, cell.getPath',0,cell.getPath())
LOG('Line.isDivergent, cell.isDivergent',0,cell.isDivergent())
if cell.isDivergent():
return 1
else:
......
......@@ -37,7 +37,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.DateUtils import addToDate, getClosestDate, getIntervalBetweenDates
from Products.ERP5Type.DateUtils import getMonthAndDaysBetween, getRoundedMonthBetween
from Products.ERP5Type.DateUtils import getMonthFraction, getYearFraction, getBissextilCompliantYearFraction
#from Products.ERP5Type.DateUtils import getMonthFraction, getYearFraction, getBissextilCompliantYearFraction
from Products.ERP5Type.DateUtils import same_movement_interval, number_of_months_in_year, centis, millis
from Products.ERP5.Document.Amount import Amount
from Products.CMFCore.WorkflowCore import WorkflowMethod
......
......@@ -122,20 +122,29 @@ an event."""
XMLObject._edit(self, *args, **kw)
self.attachments = attachments
def SendMail(from_addr=None, smtp_server=None, to_addr=None, msg=None, subject=None):
#def SendMail(from_addr=None, smtp_server=None, to_addr=None, msg=None, subject=None):
def send(from_url=None, to_url=None, msg=None, subject=None):
"""
This method was previously named 'SendMail'
smtp_server: something like localhost:11025
Send An Email
"""
if smtp_server == None:
smtp_server = 'localhost'
# We assume by default that we are replying to the sender
if from_addr == None:
from_addr = self.getTo()
if to_addr == None:
to_addr = self.getSender()
if from_url == None:
from_url = self.getUrlString()
if to_url == None:
to_url = self.getSender()
if msg is not None and subject is not None:
server = smtplib.SMTP(smtp_server)
server.sendmail()
header = "From: %s\n" % from_url
header += "To: %s\n\n" % to_url
header += "Subject: %s\n" % subject
header += "\n"
msg = header + msg
self.MailHost.send( msg )
def getReplyBody(self):
"""
......
......@@ -82,14 +82,14 @@ class PackingList(Delivery):
)
security.declareProtected(Permissions.View, 'isDivergent')
def isDivergent(self):
def isDivergent(self,**kw):
"""
Returns 1 if not simulated or inconsistent target and values
"""
if self.getSimulationState() not in self.getPortalDraftOrderStateList():
if not self.isSimulated():
return 1
return Delivery.isDivergent(self)
return Delivery.isDivergent(self,**kw)
#######################################################
# Container computation
......@@ -100,7 +100,6 @@ class PackingList(Delivery):
are not in container.
It works only if a Resource is not on 2 PackingListLine.
"""
explanation_uid = self.getUid()
for movement in self.getMovementList():
quantity = movement.getQuantity()
......
......@@ -30,6 +30,10 @@ from Products.ERP5.Document.Predicate import Predicate
# Just for compatibility
class PredicateGroup(Predicate):
"""
aaaa
"""
#pass
meta_type = 'ERP5 Predicate'
portal_type = 'Predicate Group'
......@@ -464,6 +464,9 @@ class SimulationMovement(Movement):
return 0
# XXX Those properties are the same than defined in DeliveryBuilder.
# We need to defined it only 1 time.
LOG('SimulationMovement.isDivergent',0,delivery.getPath())
LOG('SimulationMovement.isDivergent self.getStartDate()',0,self.getStartDate())
LOG('SimulationMovement.isDivergent delivery.getStartDate()',0,delivery.getStartDate())
if self.getSourceSection() != delivery.getSourceSection() or \
self.getDestinationSection() != delivery.getDestinationSection() or \
self.getSource() != delivery.getSource() or \
......@@ -498,6 +501,8 @@ class SimulationMovement(Movement):
delivery_ratio = self.getDeliveryRatio()
if delivery_ratio is not None:
d_quantity *= delivery_ratio
LOG('SimulationMovement.isDivergent d_quantity',0,d_quantity)
LOG('SimulationMovement.isDivergent quantity + d_error',0,quantity + d_error)
if d_quantity != quantity + d_error:
return 1
return 0
......
......@@ -113,3 +113,22 @@ such as web sites, emails, ftp sites, etc."""
"""
return ("http://www.erp5.org","mailto:info@erp5.org")
def send(self, from_url=None, to_url=None, msg=None, subject=None):
"""
This method was previously named 'SendMail'
Send An Email
"""
# We assume by default that we are replying to the sender
if from_url == None:
from_url = self.getUrlString()
if to_url.find('@')>=0: # We will send an email
if msg is not None and subject is not None:
header = "From: %s\n" % from_url
header += "To: %s\n" % to_url
header += "Subject: %s\n" % subject
header += "\n"
msg = header + msg
self.getPortalObject().MailHost.send( msg )
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