[Erp5-report] r23733 - /erp5/trunk/products/ERP5/Document/OrderLine.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Sep 22 11:22:19 CEST 2008
Author: kazuhiko
Date: Mon Sep 22 11:22:08 2008
New Revision: 23733
URL: http://svn.erp5.org?rev=23733&view=rev
Log:
make _getTotalPrice() and getTotalQuantity() faster.
Modified:
erp5/trunk/products/ERP5/Document/OrderLine.py
Modified: erp5/trunk/products/ERP5/Document/OrderLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderLine.py?rev=23733&r1=23732&r2=23733&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderLine.py (original)
+++ erp5/trunk/products/ERP5/Document/OrderLine.py Mon Sep 22 11:22:08 2008
@@ -94,8 +94,9 @@
if fast is argument true, then a SQL method will be used.
"""
if self.hasLineContent():
+ meta_type = self.meta_type
return sum(l.getTotalPrice(context=context)
- for l in self.contentValues(meta_type=self.meta_type))
+ for l in self.contentValues() if l.meta_type==meta_type)
return DeliveryLine._getTotalPrice(self,
default=default,
context=context,
@@ -113,8 +114,9 @@
"""
base_id = 'movement'
if self.hasLineContent():
+ meta_type = self.meta_type
return sum(l.getTotalQuantity() for l in
- self.contentValues(meta_type=self.meta_type))
+ self.contentValues() if l.meta_type==meta_type)
elif self.hasCellContent(base_id=base_id):
if fast : # Use MySQL
aggregate = self.DeliveryLine_zGetTotal()[0]
More information about the Erp5-report
mailing list