From f2425c2091bb6e23797ce90070bfc374bed943c8 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Wed, 25 May 2005 09:32:38 +0000
Subject: [PATCH] Modify hasCellContent, because it can generate inconsistency
 in the catalog.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3076 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/DeliveryLine.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py
index d24e57ae79..b94b796a32 100755
--- a/product/ERP5/Document/DeliveryLine.py
+++ b/product/ERP5/Document/DeliveryLine.py
@@ -148,9 +148,15 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
       """
           This method can be overriden
       """
-      return XMLMatrix.hasCellContent(self, base_id=base_id)
-      # If we need it faster, we can use another approach...
-      return len(self.contentValues()) > 0
+      # Do not use XMLMatrix.hasCellContent, because it can generate
+      # inconsistency in catalog
+      # Exemple: define a line and set the matrix cell range, but do not create
+      # cell.
+      # Line was in this case consider like a movement, and was catalogued.
+      # But, getVariationText of the line was not empty.
+      # So, in ZODB, resource as without variation, but in catalog, this was
+      # the contrary...
+      return int(XMLMatrix.getCellRange(self, base_id=base_id) != [])
 
     security.declareProtected( Permissions.AccessContentsInformation, 'getCellValueList' )
     def getCellValueList(self, base_id='movement'):
@@ -195,11 +201,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
       else:
          return Movement.isDivergent(self)
 
-    security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver')
-    def applyTargetSolver(self, solver):
-      for my_simulation_movement in self.getDeliveryRelatedValueList(portal_type = 'Simulation Movement'):
-        self.portal_simulation.applyTargetSolver(my_simulation_movement, solver)
-
     def applyToDeliveryLineRelatedMovement(self, portal_type='Simulation Movement', method_id = 'expand'):
       # Find related in simulation
       for my_simulation_movement in self.getDeliveryRelatedValueList(
@@ -219,8 +220,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
       if self.isIndexable:
         # Reindex children
         self.activate().recursiveImmediateReindexObject()
-        # NEW: we never rexpand simulation - This is a task for DSolver / TSolver
-        # self.activate().applyToDeliveryLineRelatedMovement(method_id = 'expand')
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getInventoriatedQuantity')
     def getInventoriatedQuantity(self):
-- 
2.30.9