Assume default vendor for new receiving batch
i.e. if there is only one vendor
This commit is contained in:
parent
25f39f4173
commit
0dc344b821
|
@ -332,13 +332,16 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
use_dropdown = vendor_handler.choice_uses_dropdown()
|
use_dropdown = vendor_handler.choice_uses_dropdown()
|
||||||
if use_dropdown:
|
if use_dropdown:
|
||||||
vendors = self.Session.query(model.Vendor)\
|
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))
|
vendor_values = [(vendor.uuid, "({}) {}".format(vendor.id, vendor.name))
|
||||||
for vendor in vendors]
|
for vendor in vendors]
|
||||||
if use_buefy:
|
if use_buefy:
|
||||||
form.set_widget('vendor', dfwidget.SelectWidget(values=vendor_values))
|
form.set_widget('vendor', dfwidget.SelectWidget(values=vendor_values))
|
||||||
else:
|
else:
|
||||||
form.set_widget('vendor', forms.widgets.JQuerySelectWidget(values=vendor_values))
|
form.set_widget('vendor', forms.widgets.JQuerySelectWidget(values=vendor_values))
|
||||||
|
if len(vendors) == 1:
|
||||||
|
form.set_default('vendor', vendors[0].uuid)
|
||||||
else:
|
else:
|
||||||
vendor_display = ""
|
vendor_display = ""
|
||||||
if self.request.method == 'POST':
|
if self.request.method == 'POST':
|
||||||
|
|
Loading…
Reference in a new issue