sum get_not_assigned_weight when netweight is not none

This commit is contained in:
Raimon Esteve 2022-11-08 11:47:25 +01:00
parent fe8dc5abf6
commit 7365d9bb4a
1 changed files with 2 additions and 1 deletions

View File

@ -415,7 +415,8 @@ class Weighing(Workflow, ModelSQL, ModelView):
cls.analysis(to_analysis)
def get_not_assigned_weight(self, name):
return self.netweight - sum([p.netweight for p in self.parcels])
if self.netweight:
return self.netweight - sum([p.netweight or 0 for p in self.parcels])
@classmethod
@ModelView.button