diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index ead0abed..ccc97d9a 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -457,7 +457,7 @@ class ReceivingBatchView(PurchasingBatchView): f.set_widget('store_uuid', dfwidget.HiddenWidget()) # purchase - if (self.creating and workflow == 'from_po' + if (self.creating and workflow in ('from_po', 'from_po_with_invoice') and self.purchase_order_fieldname == 'purchase'): if use_buefy: f.replace('purchase', 'purchase_uuid') @@ -507,6 +507,11 @@ class ReceivingBatchView(PurchasingBatchView): 'invoice_file', 'invoice_parser_key') + elif workflow == 'from_po_with_invoice': + f.remove('truck_dump_batch_uuid') + f.set_required('invoice_file') + f.set_required('invoice_parser_key') + elif workflow == 'truck_dump_children_first': f.remove('truck_dump_batch_uuid', 'invoice_file', @@ -561,6 +566,9 @@ class ReceivingBatchView(PurchasingBatchView): elif batch_type == 'from_po': # TODO: how to best handle this field? this doesn't seem flexible kwargs['purchase_key'] = batch.purchase_uuid + elif batch_type == 'from_po_with_invoice': + # TODO: how to best handle this field? this doesn't seem flexible + kwargs['purchase_key'] = batch.purchase_uuid elif batch_type == 'truck_dump_children_first': kwargs['truck_dump'] = True kwargs['truck_dump_children_first'] = True