From f6125f6bbb4b6109c18fbe29a8f07fcea5ed1ef2 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Tue, 29 Nov 2016 21:11:24 +0000 Subject: [PATCH] Fixed rechare computation of prepaid orders with metric --- orchestra/contrib/services/handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orchestra/contrib/services/handlers.py b/orchestra/contrib/services/handlers.py index 9500db13..29675e76 100644 --- a/orchestra/contrib/services/handlers.py +++ b/orchestra/contrib/services/handlers.py @@ -524,10 +524,11 @@ class ServiceHandler(plugins.Plugin, metaclass=plugins.PluginMount): bmetric = order.billed_metric if bmetric is None: bmetric = order.get_metric(order.billed_on) - bsize = self.get_price_size(rini, order.billed_until) + bsize = self.get_price_size(rini, rend) prepay_discount = self.get_price(account, bmetric) * bsize prepay_discount = round(prepay_discount, 2) for cini, cend, metric in order.get_metric(rini, rend, changes=True): + cini = max(cini, rini) size = self.get_price_size(cini, cend) price = self.get_price(account, metric) * size discounts = ()