[Erp5-report] r21188 - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 28 13:43:55 CEST 2008
Author: jerome
Date: Wed May 28 13:43:51 2008
New Revision: 21188
URL: http://svn.erp5.org?rev=21188&view=rev
Log:
Propagate default and fast arguments in _getTotalPrice and getTotalPrice
Add fast parameter in Movement._getTotalPrice (ignored, but here for consistency)
Update _getTotalPrice / getTotalPrice on some Movement subclasses to support default argument (default is still 0.0)
Modified:
erp5/trunk/products/ERP5/Document/DeliveryCell.py
erp5/trunk/products/ERP5/Document/DeliveryLine.py
erp5/trunk/products/ERP5/Document/Movement.py
erp5/trunk/products/ERP5/Document/OrderCell.py
erp5/trunk/products/ERP5/Document/OrderLine.py
Modified: erp5/trunk/products/ERP5/Document/DeliveryCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/DeliveryCell.py?rev=21188&r1=21187&r2=21188&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryCell.py (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryCell.py Wed May 28 13:43:51 2008
@@ -98,11 +98,11 @@
return Movement.getPrice(self, *args, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice')
- def getTotalPrice(self, *args, **kw):
+ def getTotalPrice(self, default=0.0, *args, **kw):
"""
call Movement.getTotalPrice
"""
- return Movement.getTotalPrice(self, *args, **kw)
+ return Movement.getTotalPrice(self, default=default, *args, **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=21188&r1=21187&r2=21188&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryLine.py (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryLine.py Wed May 28 13:43:51 2008
@@ -114,10 +114,10 @@
"""
return self.getParentValue().isAccountable() and (not self.hasCellContent())
- def _getTotalPrice(self, context, fast=0):
+ def _getTotalPrice(self, default=0.0, context=None, fast=0):
""" Returns the total price for this line or the cells it contains. """
if not self.hasCellContent(base_id='movement'):
- return Movement._getTotalPrice(self, 0.0, context)
+ return Movement._getTotalPrice(self, default=default, context=context)
elif fast: # Use MySQL
return self.DeliveryLine_zGetTotal()[0].total_price or 0.0
return sum(cell.getTotalPrice(default=0.0, context=context)
Modified: erp5/trunk/products/ERP5/Document/Movement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Movement.py?rev=21188&r1=21187&r2=21188&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Movement.py (original)
+++ erp5/trunk/products/ERP5/Document/Movement.py Wed May 28 13:43:51 2008
@@ -203,7 +203,7 @@
if operand_dict is not None:
return operand_dict['price']
- def _getTotalPrice(self, default=None, context=None):
+ def _getTotalPrice(self, default=None, context=None, fast=0):
price = self.getPrice(context=context)
quantity = self.getQuantity()
if isinstance(price, (int, float)) and \
@@ -297,7 +297,7 @@
default = None
tmp_context = self.asContext(context=context, REQUEST=REQUEST, **kw)
- return self._getTotalPrice(context=tmp_context, **kw)
+ return self._getTotalPrice(default=default, context=tmp_context, fast=fast, **kw)
security.declareProtected( Permissions.AccessContentsInformation,
'getTotalQuantity')
Modified: erp5/trunk/products/ERP5/Document/OrderCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderCell.py?rev=21188&r1=21187&r2=21188&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderCell.py (original)
+++ erp5/trunk/products/ERP5/Document/OrderCell.py Wed May 28 13:43:51 2008
@@ -84,10 +84,11 @@
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalPrice')
- def getTotalPrice(self, *args, **kw):
+ def getTotalPrice(self, default=0.0, *args, **kw):
"only return a value if self is a movement"
- if not self.isMovement(): return 0.0
- return DeliveryCell.getTotalPrice(self, *args, **kw)
+ if not self.isMovement():
+ return default
+ return DeliveryCell.getTotalPrice(self, default=default, *args, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
Modified: erp5/trunk/products/ERP5/Document/OrderLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderLine.py?rev=21188&r1=21187&r2=21188&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderLine.py (original)
+++ erp5/trunk/products/ERP5/Document/OrderLine.py Wed May 28 13:43:51 2008
@@ -80,7 +80,7 @@
transactional_variable[call_method_key] = result
return result
- def _getTotalPrice(self, context, fast=0):
+ def _getTotalPrice(self, default=0.0, context=None, fast=0):
"""Returns the total price for this order line.
if hasLineContent: return sum of lines total price
@@ -91,7 +91,10 @@
if self.hasLineContent():
return sum(l.getTotalPrice(context=context)
for l in self.contentValues(meta_type=self.meta_type))
- return DeliveryLine._getTotalPrice(self, context=context, fast=fast)
+ return DeliveryLine._getTotalPrice(self,
+ default=default,
+ context=context,
+ fast=fast)
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
More information about the Erp5-report
mailing list