Skip to content

Commit f2062df

Browse files
committed
Ignore archived stock types when Enter is pressed on Name field
The popup menu of stock types that appears when Enter is pressed on the Name field of the stock type selection popup was still including archived stock types.
1 parent e52dba6 commit f2062df

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

quicktill/stocktype.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,15 @@ def name_enter(self):
173173
# possible existing StockTypes based on a fuzzy match with the
174174
# manufacturer and the name.
175175

176-
l = td.s.query(StockType).\
177-
filter(StockType.manufacturer.ilike(
178-
'%{}%'.format(self.manufield.f.strip()))).\
179-
filter(StockType.name.ilike(
180-
'%{}%'.format(self.namefield.f.strip()))).\
181-
order_by(StockType.manufacturer, StockType.name,
182-
StockType.dept_id).\
183-
all()
176+
l = td.s.query(StockType)\
177+
.filter(StockType.manufacturer.ilike(
178+
'%{}%'.format(self.manufield.f.strip())))\
179+
.filter(StockType.name.ilike(
180+
'%{}%'.format(self.namefield.f.strip())))\
181+
.filter(StockType.archived == False)\
182+
.order_by(StockType.manufacturer, StockType.name,
183+
StockType.dept_id)\
184+
.all()
184185
if len(l) == 1:
185186
self.existing_stocktype_chosen(l[0].id)
186187
return

0 commit comments

Comments
 (0)