From 03dad826636c520168acfbbfcf034e50e4262aba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Nov 2021 16:50:13 -0600 Subject: [PATCH] Add basic support for receiving from PO with invoice --- tailbone/views/purchasing/receiving.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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