From a283988896b331ff9a74be95545b4ded03bd8fdb 2022-08-09 14:35:57 From: Lance Edgar Date: 2022-08-09 14:35:57 Subject: [PATCH] Add `choice_uses_dropdown()` method for customer handler --- diff --git a/rattail/clientele.py b/rattail/clientele.py index de67a503516b172b08cf919b11496d32094abbe9..d2946b506db8d71a32334d646f1b720831bceb52 100644 --- a/rattail/clientele.py +++ b/rattail/clientele.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -35,6 +35,20 @@ class ClienteleHandler(GenericHandler): Base class and default implementation for clientele handlers. """ + def choice_uses_dropdown(self): + """ + Returns boolean indicating whether a customer choice should be + presented to the user via a dropdown (select) element, vs. an + autocomplete field. The latter is the default because + potentially the customer list can be quite large, so we avoid + loading them all in the dropdown unless so configured. + + :returns: Boolean; if true then a dropdown should be used; + otherwise (false) autocomplete is used. + """ + return self.config.getbool('rattail', 'customers.choice_uses_dropdown', + default=False) + def ensure_customer(self, person): """ Returns the customer record associated with the given person, creating