rattail.autocomplete.customers

Autocomplete Handler for Customers

class rattail.autocomplete.customers.CustomerAutocompleter(config)[source]

Autocompleter for Customers (by name)

model_class

alias of Customer

class rattail.autocomplete.customers.CustomerNewOrderAutocompleter(config)[source]

Special “new order” autocompleter for customers.

We set it apart with a different key ('customers.neworder') so that you can override it independently of other customer autocompleters.

But the default logic for this one is a bit special too, in that it will try to search for either phone number or customer name. If the search term includes at least 4 digits then it is considered to be a phone number search; otherwise it will be considered a name search.

model_class

alias of Customer

phone_model_class

alias of CustomerPhoneNumber

class rattail.autocomplete.customers.CustomerPhoneAutocompleter(config)[source]

Autocompleter for Customers (by phone)

Note

As currently implemented, this view will only work with a PostgreSQL database. It normalizes the user’s search term and the database values to numeric digits only (i.e. removes special characters from each) in order to be able to perform smarter matching. However normalizing the database value currently uses the PG SQL regexp_replace() function.

make_autocomplete_query(session, term, **kwargs)[source]

Build the complete query from which to obtain search results.

prepare_autocomplete_term(term, **kwargs)[source]

If necessary, massage the incoming search term for use with the autocomplete query.