diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py
index 681a96f82b269e61b0be0ba6ef5e5ea319e5662c..5172a67e40989545a6e198716bbb32508dc129e7 100755
--- a/product/ERP5/Document/Delivery.py
+++ b/product/ERP5/Document/Delivery.py
@@ -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
 
     #######################################################
diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py
index 4786fdfd0c83a373b898fbccbcb2b6ee33c278c2..1d62683b4a90a26d6fc860686e779453eaaf8974 100755
--- a/product/ERP5/Document/DeliveryLine.py
+++ b/product/ERP5/Document/DeliveryLine.py
@@ -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:
diff --git a/product/ERP5/Document/Item.py b/product/ERP5/Document/Item.py
index 54a7b60dfedbecb5c231035a3cd3f1001ea5c4ca..c54dfd771efe55b46d8522250593641bc4942484 100755
--- a/product/ERP5/Document/Item.py
+++ b/product/ERP5/Document/Item.py
@@ -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
diff --git a/product/ERP5/Document/MailMessage.py b/product/ERP5/Document/MailMessage.py
index 7a1d679b34c0ff211773e7ece41e3c2b5b58ddfc..10adc8ef6a11638b9eec6b1871d410e32c96ab57 100755
--- a/product/ERP5/Document/MailMessage.py
+++ b/product/ERP5/Document/MailMessage.py
@@ -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):
       """
diff --git a/product/ERP5/Document/PackingList.py b/product/ERP5/Document/PackingList.py
index c611032b13ffa34f04a54d85e579665f547b55de..791031df9ad91ade9f5725dba618202a8d362c72 100755
--- a/product/ERP5/Document/PackingList.py
+++ b/product/ERP5/Document/PackingList.py
@@ -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()
diff --git a/product/ERP5/Document/PredicateGroup.py b/product/ERP5/Document/PredicateGroup.py
index 60591616fcc314e15059445bec23faa754bc8c8c..524dd02b737a48d42998746abd4e4f60c2e0c9b2 100755
--- a/product/ERP5/Document/PredicateGroup.py
+++ b/product/ERP5/Document/PredicateGroup.py
@@ -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'
 
diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py
index 13d772739bb2cb5912db55221315f9bbfd55df83..fe52ef852bc8b21be190e26ce45ae57717fd4f09 100755
--- a/product/ERP5/Document/SimulationMovement.py
+++ b/product/ERP5/Document/SimulationMovement.py
@@ -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  
diff --git a/product/ERP5/Document/Url.py b/product/ERP5/Document/Url.py
index 7d936f91276dc41054227f85a23abf51467ed716..27a592ccf8cf5e7c9cabf2bb484e3d4c90b1db0d 100755
--- a/product/ERP5/Document/Url.py
+++ b/product/ERP5/Document/Url.py
@@ -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 )
+