Assume default receiving workflow if there is only one

This commit is contained in:
Lance Edgar 2021-12-07 19:58:11 -06:00
parent ff588b6a5c
commit 60222c4977

View file

@ -291,6 +291,8 @@ class ReceivingBatchView(PurchasingBatchView):
else: else:
form.set_widget('workflow', form.set_widget('workflow',
forms.widgets.JQuerySelectWidget(values=values)) forms.widgets.JQuerySelectWidget(values=values))
if len(workflows) == 1:
form.set_default('workflow', workflows[0]['workflow_key'])
form.submit_label = "Continue" form.submit_label = "Continue"
form.cancel_url = self.get_index_url() form.cancel_url = self.get_index_url()
@ -753,8 +755,8 @@ class ReceivingBatchView(PurchasingBatchView):
# flag is set, since that batch type is only concerned with receiving # flag is set, since that batch type is only concerned with receiving
batch = self.get_instance() batch = self.get_instance()
if batch.is_truck_dump_parent() and not batch.truck_dump_children_first: if batch.is_truck_dump_parent() and not batch.truck_dump_children_first:
g.hide_column('cases_ordered') g.remove('cases_ordered',
g.hide_column('units_ordered') 'units_ordered')
# add "Transform to Unit" action, if appropriate # add "Transform to Unit" action, if appropriate
if batch.is_truck_dump_parent(): if batch.is_truck_dump_parent():
@ -771,7 +773,7 @@ class ReceivingBatchView(PurchasingBatchView):
# truck_dump_status # truck_dump_status
if not batch.is_truck_dump_parent(): if not batch.is_truck_dump_parent():
g.hide_column('truck_dump_status') g.remove('truck_dump_status')
else: else:
g.set_enum('truck_dump_status', model.PurchaseBatchRow.STATUS) g.set_enum('truck_dump_status', model.PurchaseBatchRow.STATUS)