Commit dd148c9a authored by Romain Courteaud's avatar Romain Courteaud

Recommit a previous modification of hasCellContent.

As we use hasCellContent to know if Line define a Movement or not, I need to
modify the meaning of this method.
Now, it return true if Line has a range different from [].


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3662 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d53c930d
...@@ -143,24 +143,28 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated): ...@@ -143,24 +143,28 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
aggregate = self.DeliveryLine_zGetTotal()[0] aggregate = self.DeliveryLine_zGetTotal()[0]
return aggregate.total_quantity or 0.0 return aggregate.total_quantity or 0.0
security.declareProtected( Permissions.ModifyPortalContent, 'hasCellContent' ) security.declareProtected(Permissions.View, 'hasCellContent')
def hasCellContent(self, base_id='movement'): def hasCellContent(self, base_id='movement'):
""" """
This method can be overriden This method can be overriden
""" """
# 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...
cell_range = XMLMatrix.getCellRange(self, base_id=base_id)
return (cell_range is not None and len(cell_range) > 0)
# DeliveryLine can be a movement when it does not content any cell and # DeliveryLine can be a movement when it does not content any cell and
# matrix cell range is not empty. # matrix cell range is not empty.
return XMLMatrix.hasCellContent(self, base_id=base_id) # Better implementation is needed.
# # Do not use XMLMatrix.hasCellContent, because it can generate # We want to define a line without cell, defining a variated resource.
# # inconsistency in catalog # If we modify the cell range, we need to move the quantity to a new
# # Exemple: define a line and set the matrix cell range, but do not create # cell, which define the same variated resource.
# # cell. # return XMLMatrix.hasCellContent(self, base_id=base_id)
# # 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...
# cell_range = XMLMatrix.getCellRange(self, base_id=base_id)
# return (cell_range is not None and len(cell_range) > 0)
security.declareProtected( Permissions.AccessContentsInformation, 'getCellValueList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getCellValueList' )
def getCellValueList(self, base_id='movement'): def getCellValueList(self, base_id='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