Commit e4b7bb0f authored by Sebastien Robin's avatar Sebastien Robin

methods related to supply must not be there, it must be on supply Line


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2787 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 12bdfa8f
......@@ -499,92 +499,6 @@ class Resource(XMLMatrix, CoreResource, Variated):
invalidate = WorkflowMethod( invalidate )
security.declareProtected( Permissions.ModifyPortalContent, 'updateSupplyMatrix' )
def updateSupplyMatrix(self):
"""
Define the indices provided
one list per index (kw)
Any number of list can be provided
"""
# Update the cell range automatically
# This is far from easy and requires some specific wizzardry
base_id = 'path'
kwd = {'base_id': base_id}
new_range = self.SupplyLine_asCellRange() # This is a site dependent script
# range must not content empty list
new_range = filter(lambda x: x != [], new_range)
self._setCellRange(*new_range, **kwd )
# XXX need to update the cells content....
# i did not do anything, because where is maybe some method for continuous range (Romain)
# XXX why creating all cells ? it takes too much time and is not very useful (Romain)
# and it is not updated when we create a variation
# and Base_edit does not create such cell....
"""
cell_range_key_list = self.getCellRangeKeyList(base_id = base_id)
if cell_range_key_list <> [[None, None]] :
None
for k in cell_range_key_list:
#LOG('new cell',0,str(k))
c = self.newCell(*k, **kwd)
c.edit( domain_base_category_list = self.getVariationBaseCategoryList(),
mapped_value_property_list = ( 'price',),
predicate_operator = 'SUPERSET_OF',
predicate_category_list = filter(lambda k_item: k_item is not None, k),
variation_category_list = filter(lambda k_item: k_item is not None, k),
force_update = 1
) # Make sure we do not take aquisition into account
else:
# If only one cell, delete it
cell_range_id_list = self.getCellRangeIdList(base_id = base_id)
for k in cell_range_id_list:
if self.get(k) is not None:
self[k].flushActivity(invoke=0)
self[k].immediateReindexObject() # We are forced to do this is url is changed (not uid)
self._delObject(k)
"""
# TO BE DONE XXX
# reindex cells when price, quantity or source/dest changes
# For generation of matrix lines
security.declareProtected( Permissions.ModifyPortalContent, '_setQuantityStepList' )
def _setQuantityStepList(self, value):
self._baseSetQuantityStepList(value)
value = self.getQuantityStepList()
value.sort()
for pid in self.contentIds(filter={'portal_type': 'Predicate Group'}):
self.deleteContent(pid)
if len(value) > 0:
value = value
# initialisation
i = 0
p = self.newContent(id = 'quantity_range_%s' % str(i), portal_type = 'Predicate Group')
p.setCriterionPropertyList(('quantity', ))
p.setCriterion('quantity', min=None, max=value[i])
p.setTitle(' quantity < %s' % repr(value[i]))
for i in range(0, len(value) -1 ):
p = self.newContent(id = 'quantity_range_%s' % str(i+1), portal_type = 'Predicate Group')
p.setCriterionPropertyList(('quantity', ))
p.setCriterion('quantity', min=value[i], max=value[i+1])
p.setTitle('%s <= quantity < %s' % (repr(value[i]),repr(value[i+1])))
# end
i = len(value) - 1
p = self.newContent(id = 'quantity_range_%s' % str(i+1), portal_type = 'Predicate Group')
p.setCriterionPropertyList(('quantity', ))
p.setCriterion('quantity', min=value[i], max=None)
p.setTitle('%s <= quantity' % repr(value[i]))
self.updateSupplyMatrix()
# Predicate handling
security.declareProtected(Permissions.AccessContentsInformation, 'asPredicate')
def asPredicate(self):
......
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