[Erp5-report] r20548 - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Apr 15 18:15:39 CEST 2008
Author: alex
Date: Tue Apr 15 18:15:39 2008
New Revision: 20548
URL: http://svn.erp5.org?rev=20548&view=rev
Log:
Remove old or useless methods, allow price calculation to work on cells.
Modified:
erp5/trunk/products/ERP5/Document/Delivery.py
erp5/trunk/products/ERP5/Document/DeliveryCell.py
erp5/trunk/products/ERP5/Document/DeliveryLine.py
Modified: erp5/trunk/products/ERP5/Document/Delivery.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Delivery.py?rev=20548&r1=20547&r2=20548&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Delivery.py (original)
+++ erp5/trunk/products/ERP5/Document/Delivery.py Tue Apr 15 18:15:39 2008
@@ -106,13 +106,6 @@
"""
"""
return self._getDestinationTotalPrice(self.asContext(context=context, REQUEST=REQUEST, **kw))
-
- # Pricing
- security.declareProtected( Permissions.ModifyPortalContent, 'updatePrice' )
- def updatePrice(self):
- for c in self.objectValues():
- if hasattr(aq_base(c), 'updatePrice'):
- c.updatePrice()
security.declareProtected( Permissions.AccessContentsInformation,
'getTotalPrice')
Modified: erp5/trunk/products/ERP5/Document/DeliveryCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/DeliveryCell.py?rev=20548&r1=20547&r2=20548&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryCell.py (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryCell.py Tue Apr 15 18:15:39 2008
@@ -72,14 +72,6 @@
, PropertySheet.ItemAggregation
)
- # Explicit acquisition of aq_dynamic generated method
- security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationState')
- def getSimulationState(self):
- """
- Explicitly acquire simulation_state from parent
- """
- return self.getParentValue().getSimulationState()
-
# MatrixBox methods
security.declareProtected( Permissions.AccessContentsInformation,
@@ -98,113 +90,12 @@
"""
return self.getParentValue().getParentValue().isAccountable()
- security.declareProtected( Permissions.AccessContentsInformation, 'getProperty' )
- def getProperty(self, key, d=None):
- """
- Generic accessor. First we check if the value
- exists. Else we call the real accessor
- """
-
- #try:
- if 1:
- # If mapped_value_property_list is not set
- # then it creates an exception
- if key in self.getMappedValuePropertyList([]):
- if getattr(self, key, None) is not None:
- return getattr(self, key)
- else:
- LOG("Not Found Property %s"%key, -100,"")
- return self.getParentValue().getProperty(key)
- #except:
- # LOG("WARNING: ERP5", 0, 'Could not access mapped value property %s' % key)
- # return None
- # Standard accessor
- try:
- result = Movement.getProperty(self, key, d=d)
- except AttributeError:
- result = None
- return result
-
- security.declareProtected( Permissions.ModifyPortalContent, 'updatePrice' )
- def updatePrice(self):
- if 'price' in self.getMappedValuePropertyList([]):
- # Try to compute an average price by accessing simulation movements
- # This should always return 0 in the case of OrderCell
- total_quantity = 0.0
- total_price = 0.0
- for m in self.getDeliveryRelatedValueList(portal_type="Simulation Movement"):
- order = m.getOrderValue()
- if order is not None:
- # Price is defined in an order
- price = m.getPrice()
- quantity = m.getQuantity()
- try:
- price = float(price)
- quantity = float(quantity)
- except TypeError:
- price = 0.0
- quantity = 0.0
- total_quantity += quantity
- total_price += quantity * price
- if total_quantity:
- # Update local price
- # self._setPrice(total_price / total_quantity)
- self.setPrice( total_price / total_quantity )
-
- security.declareProtected( Permissions.AccessContentsInformation, 'getPrice' )
+ security.declareProtected(Permissions.AccessContentsInformation, 'getPrice')
def getPrice(self, context=None, REQUEST=None, **kw):
"""
- Returns the price if defined on the cell
- or acquire it
+ call Movement.getPrice
"""
- # Call a script on the context
- if 'price' in self.getMappedValuePropertyList([]):
- if getattr(aq_base(self), 'price', None) is not None:
- # default returns a price defined by the mapped value
- return getattr(self, 'price')
- else:
- return self.getParentValue().getProperty('price') # Price is acquired
- else:
- return None
-
- security.declareProtected( Permissions.AccessContentsInformation,
- 'getQuantity' )
- def getQuantity(self):
- """
- Returns the quantity if defined on the cell
- or acquire it
- """
- # Call a script on the context
- if 'quantity' in self.getMappedValuePropertyList([]):
- if getattr(aq_base(self), 'quantity', None) is not None:
- return getattr(self, 'quantity')
- else:
- return self.getParentValue().getProperty('quantity')
- else:
- # We have acquisition here which me should mimic
- return self.getParentValue().getQuantity()
-
- # Required for indexing
- security.declareProtected(Permissions.AccessContentsInformation,
- 'getInventoriatedQuantity')
- def getInventoriatedQuantity(self):
- """
- """
- return Movement.getInventoriatedQuantity(self)
-
- security.declareProtected(Permissions.AccessContentsInformation,
- 'getStartDate')
- def getStartDate(self):
- """
- """
- return self._baseGetStartDate()
-
- security.declareProtected(Permissions.AccessContentsInformation,
- 'getStopDate')
- def getStopDate(self):
- """
- """
- return self._baseGetStopDate()
+ return Movement.getPrice(self, context=context, REQUEST=REQUEST, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getRootDeliveryValue')
Modified: erp5/trunk/products/ERP5/Document/DeliveryLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/DeliveryLine.py?rev=20548&r1=20547&r2=20548&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryLine.py (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryLine.py Tue Apr 15 18:15:39 2008
@@ -75,17 +75,6 @@
# Multiple inheritance definition
updateRelatedContent = XMLMatrix.updateRelatedContent
- # Explicit acquisition of aq_dynamic generated method
- security.declareProtected(Permissions.AccessContentsInformation,
- 'getSimulationState')
- def getSimulationState(self):
- """
- Explicitly acquire simulation_state from parent
- """
- method = getattr(self.getParentValue(),'getSimulationState', None)
- if method is not None:
- return method()
-
# Force in _edit to modify variation_base_category_list first
security.declarePrivate( '_edit' )
def _edit(self, REQUEST=None, force_update = 0, **kw):
More information about the Erp5-report
mailing list