From d800c6950c2c56550090a544aa621ecfd2e879d2 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 9 May 2022 16:48:34 +0200 Subject: [PATCH] fixed bug --- ereuse_devicehub/inventory/forms.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 8ef0835a..a04b5e75 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -142,9 +142,7 @@ class FilterForm(FlaskForm): if self.device_type: self.filter.data = self.device_type - def search(self): - - # Filter from lots + def filter_from_lots(self): if self.lot_id: self.lot = self.lots.filter(Lot.id == self.lot_id).one() device_ids = (d.id for d in self.lot.devices) @@ -154,6 +152,8 @@ class FilterForm(FlaskForm): lots=None ) + def search(self): + self.filter_from_lots() filter_type = None if self.device_type: filter_type = [self.device_type] @@ -165,9 +165,12 @@ class FilterForm(FlaskForm): if "All Devices" == self.device_type: filter_type = None - if "All Components" == self.device_type: + elif "All Components" == self.device_type: filter_type = COMPONENTS + elif "All Computers" == self.device_type: + filter_type = COMPUTERS + elif "All Monitors" == self.device_type: filter_type = MONITORS