From 1b83cf35c475d8736a960cb62e756116e99045dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Thu, 3 Oct 2013 07:38:58 +0200 Subject: [PATCH] =?utf8?q?Bugfix=C2=A0:=20reduce=20sur=20une=20liste=20d'u?= =?utf8?q?n=20=C3=A9l=C3=A9ment=20provoque=20des=20effets=20de=20bords.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- order.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/order.py b/order.py index 2948aaf..9323dd3 100755 --- a/order.py +++ b/order.py @@ -337,9 +337,10 @@ class PrintOrder(PortalContent, DefaultDublinCoreImpl) : 'PAYMENTREQUEST_0_SHIPTOPHONENUM' : self.billing['phone'], } - quantitySum = reduce(lambda a, b : a['quantity'] + b['quantity'], self.items) - priceSum = reduce(lambda a, b : a['unit_price'] * a['quantity'] + b['unit_price'] * b['quantity'], self.items) - priceValues = priceSum.getValues() + if len(self.items) > 1 : + quantitySum = reduce(lambda a, b : a['quantity'] + b['quantity'], self.items) + else : + quantitySum = self.items[0]['quantity'] total = round(self.amountWithFees.getValues()['taxed'], 2) options['L_PAYMENTREQUEST_0_NAME0'] = 'Commande realis photo ref. %s' % self.getId() -- 2.20.1