Changeset - e46fbbd62ccd
[Not reviewed]
0 1 0
Lance Edgar (lance) - 3 years ago 2021-10-15 16:50:18
lance@edbob.org
Limit autocomplete results for customer/phone lookup in new custorder

otherwise it's possible for the whole thing to bog down and freeze the
browser page...
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rattail/batch/custorder.py
Show inline comments
 
@@ -355,6 +355,10 @@ class CustomerOrderBatchHandler(BatchHandler):
 
        # oh, and sort by something useful
 
        query = query.order_by(model.Customer.name)
 

	
 
        # and finally, limit the number of results to something a
 
        # browser is likely to be able to handle easily!
 
        query = query[:100]     # TODO: make configurable?
 

	
 
        # generate result list from query
 
        results = []
 
        for customer in query:
 
@@ -401,6 +405,10 @@ class CustomerOrderBatchHandler(BatchHandler):
 
        # oh, and sort by something useful
 
        query = query.order_by(model.Person.display_name)
 

	
 
        # and finally, limit the number of results to something a
 
        # browser is likely to be able to handle easily!
 
        query = query[:100]     # TODO: make configurable?
 

	
 
        # generate result list from query
 
        results = []
 
        for person in query:
0 comments (0 inline, 0 general)