diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index bca9ef64..3f49bf9a 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -332,13 +332,16 @@ class ReceivingBatchView(PurchasingBatchView): use_dropdown = vendor_handler.choice_uses_dropdown() if use_dropdown: vendors = self.Session.query(model.Vendor)\ - .order_by(model.Vendor.id) + .order_by(model.Vendor.id)\ + .all() vendor_values = [(vendor.uuid, "({}) {}".format(vendor.id, vendor.name)) for vendor in vendors] if use_buefy: form.set_widget('vendor', dfwidget.SelectWidget(values=vendor_values)) else: form.set_widget('vendor', forms.widgets.JQuerySelectWidget(values=vendor_values)) + if len(vendors) == 1: + form.set_default('vendor', vendors[0].uuid) else: vendor_display = "" if self.request.method == 'POST':