Add basic support for receiving from PO with invoice

This commit is contained in:
Lance Edgar 2021-11-25 16:50:13 -06:00
parent e8828efae3
commit 03dad82663

View file

@ -457,7 +457,7 @@ class ReceivingBatchView(PurchasingBatchView):
f.set_widget('store_uuid', dfwidget.HiddenWidget()) f.set_widget('store_uuid', dfwidget.HiddenWidget())
# purchase # 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'): and self.purchase_order_fieldname == 'purchase'):
if use_buefy: if use_buefy:
f.replace('purchase', 'purchase_uuid') f.replace('purchase', 'purchase_uuid')
@ -507,6 +507,11 @@ class ReceivingBatchView(PurchasingBatchView):
'invoice_file', 'invoice_file',
'invoice_parser_key') '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': elif workflow == 'truck_dump_children_first':
f.remove('truck_dump_batch_uuid', f.remove('truck_dump_batch_uuid',
'invoice_file', 'invoice_file',
@ -561,6 +566,9 @@ class ReceivingBatchView(PurchasingBatchView):
elif batch_type == 'from_po': elif batch_type == 'from_po':
# TODO: how to best handle this field? this doesn't seem flexible # TODO: how to best handle this field? this doesn't seem flexible
kwargs['purchase_key'] = batch.purchase_uuid 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': elif batch_type == 'truck_dump_children_first':
kwargs['truck_dump'] = True kwargs['truck_dump'] = True
kwargs['truck_dump_children_first'] = True kwargs['truck_dump_children_first'] = True