From f6b9d9e6d05adc56488971bf3aba394fe2cfd859 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 24 Aug 2021 22:33:29 +1000 Subject: [PATCH] Revert "WIP" This reverts commit 42af52ee51a2bf402a80ea1b7d056ae4092f956c. --- .../order/templates/order/order_base.html | 5 - InvenTree/templates/js/translated/order.js | 141 +----------------- 2 files changed, 1 insertion(+), 145 deletions(-) diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index e0228ac949..0d46207c33 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -188,11 +188,6 @@ $("#edit-order").click(function() { }); $("#receive-order").click(function() { - - receivePurchaseOrder({{ order.pk }}); - - return; - launchModalForm("{% url 'po-receive' order.id %}", { reload: true, secondary: [ diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index d304b1c42b..c6dd773373 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -103,146 +103,6 @@ function removeOrderRowFromOrderWizard(e) { $('#' + row).remove(); } - -function receivePurchaseOrder(orderId, options={}) { - /* Receive parts against a purchase order. - * Launches a modal form. - * - * Required Args: - * - orderId: pk value for the PurchaseOrder - * - * Optional Args: - * - lines: List of purchase order lines to receive - * (If omitted, lines will be requested via the API) - */ - - // List of lines to receive - var selectedLines = options.lines || []; - - // List of line items to receive - var lineItems = []; - - inventreeGet( - '{% url "api-po-line-list" %}', - { - order: orderId, - part_detail: true, - }, - { - success: function(results) { - for (var idx = 0; idx < results.length; idx++) { - var line = results[idx]; - - // Skip / ignore lines missing part information - if (!line.part || !line.supplier_part_detail.part) { - continue; - } - - // Skip / ignore lines which are fully received - if (line.received >= line.quantity) { - continue; - } - - if (selectedLines.length == 0 || selectedLines.includes(line.pk)) { - lineItems.push(line); - } - } - - // Construct a form for processing - var html = ` - - - - - - - - - - - - - -
{% trans "Part" %}{% trans "SKU" %}{% trans "On Order" %}{% trans "Received" %}{% trans "Quantity" %}{% trans "Status" %}{% trans "Destination" %}
- `; - - constructForm(`/api/order/po/${orderId}/receive/`, { - method: 'POST', - title: '{% trans "Receive Items" %}', - confirm: true, - fields: { - location: {}, - }, - preFormContent: html, - afterRender: function(fields, options) { - - var table = $(options.modal).find('#line-items-table').children('tbody'); - - options.hideLabels = true; - - var parameters = {}; - - // Insert a row for each item - lineItems.forEach(function(item) { - - var part = item.part_detail; - var supplier_part = item.supplier_part_detail; - - var row = ''; - - // Part detail - row += `${thumbnailImage(part.thumbnail)} ${part.full_name}`; - - // Order code - row += `${supplier_part.SKU}`; - - // Quantity on order - row += `${line.quantity}`; - - // Quantity received - row += `${line.received}`; - - parameters = fields.items.child.children.quantity; - parameters.value = line.quantity - line.received; - - // Quantity input - row += tdWrap(constructField( - `quantity_${line.pk}`, - parameters, - options - )); - - // Status input - row += tdWrap(constructField( - `status_${line.pk}`, - fields.items.child.children.status, - options - )); - - // Location input - row += tdWrap(constructField( - `location_${line.pk}`, - fields.items.child.children.location, - options - )); - - table.append(trWrap(row)); - - parameters = fields.items.child.children.location; - - parameters.name = `location_${line.pk}`; - - initializeRelatedField(parameters, fields, options); - - }); - } - }); - } - } - ); -} - - function newSupplierPartFromOrderWizard(e) { /* Create a new supplier part directly from an order form. * Launches a secondary modal and (if successful), @@ -257,6 +117,7 @@ function newSupplierPartFromOrderWizard(e) { if (!part) { part = $(src).closest('button').attr('part'); + console.log('parent: ' + part); } createSupplierPart({