From 3299321e97a96029e4c3f1a762f4a1b2f51ff8f6 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Mon, 22 Sep 2008 09:22:08 +0000 Subject: [PATCH] make _getTotalPrice() and getTotalQuantity() faster. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23733 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/OrderLine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/OrderLine.py b/product/ERP5/Document/OrderLine.py index a60310c98b..59891070c1 100644 --- a/product/ERP5/Document/OrderLine.py +++ b/product/ERP5/Document/OrderLine.py @@ -94,8 +94,9 @@ class OrderLine(DeliveryLine): 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 @@ class OrderLine(DeliveryLine): """ 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] -- 2.30.9