From af37939a47d35bbfc9df4d89e45669f801302ded Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Fri, 25 Nov 2022 13:34:38 +0100 Subject: [PATCH] sum purchase_quantity when netweight is not null --- plot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plot.py b/plot.py index b31772d..75ec670 100644 --- a/plot.py +++ b/plot.py @@ -136,7 +136,8 @@ class Parcel(ModelSQL, ModelView): )*self.surface, 2) def get_purchased_quantity(self, name): - return sum([w.netweight for w in self.weighings if not w.table]) + return sum([w.netweight for w in self.weighings + if w.netweight and not w.table]) def get_remaining_quantity(self, name): return (self.max_production or 0) - (self.purchased_quantity or 0)