sum purchase_quantity when netweight is not null

This commit is contained in:
Raimon Esteve 2022-11-25 13:34:38 +01:00
parent 012564fc44
commit af37939a47
1 changed files with 2 additions and 1 deletions

View File

@ -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)