From 746e9ab98358dedc18ce3bb9aa66a4a5fcee869e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 20 Apr 2020 09:48:33 +1000 Subject: [PATCH] Fix rendering of PurchaseOrder table --- .../static/script/inventree/order.js | 20 ++++++++++--------- InvenTree/order/serializers.py | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/order.js b/InvenTree/InvenTree/static/script/inventree/order.js index 12b2fd4333..d583ebcdc4 100644 --- a/InvenTree/InvenTree/static/script/inventree/order.js +++ b/InvenTree/InvenTree/static/script/inventree/order.js @@ -104,21 +104,23 @@ function removePurchaseOrderLineItem(e) { function loadPurchaseOrderTable(table, options) { /* Create a purchase-order table */ - var params = options.params || {}; + options.params = options.params || {}; + + options.params['supplier_detail'] = true; var filters = loadTableFilters("order"); - for (var key in params) { - filters[key] = params[key]; + for (var key in options.params) { + filters[key] = options.params[key]; } - setupFilterList("order", table); + setupFilterList("order", $(table)); $(table).inventreeTable({ url: options.url, queryParams: filters, groupBy: false, - original: params, + original: options.params, formatNoMatches: function() { return "No purchase orders found"; }, columns: [ { @@ -131,15 +133,15 @@ function loadPurchaseOrderTable(table, options) { field: 'reference', title: 'Purchase Order', formatter: function(value, row, index, field) { - return renderLink(value, "/order/purchase-order/" + row.pk + "/"); + return renderLink(value, `/order/purchase-order/${row.pk}/`); } }, { sortable: true, - field: 'supplier', + field: 'supplier_detail', title: 'Supplier', formatter: function(value, row, index, field) { - return imageHoverIcon(row.supplier__image) + renderLink(row.supplier__name, '/company/' + value + '/purchase-orders/'); + return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`); } }, { @@ -162,7 +164,7 @@ function loadPurchaseOrderTable(table, options) { }, { sortable: true, - field: 'lines', + field: 'line_items', title: 'Items' }, ], diff --git a/InvenTree/order/serializers.py b/InvenTree/order/serializers.py index ab1471cdc1..935166e82a 100644 --- a/InvenTree/order/serializers.py +++ b/InvenTree/order/serializers.py @@ -48,6 +48,9 @@ class POSerializer(InvenTreeModelSerializer): fields = [ 'pk', + 'issue_date', + 'complete_date', + 'creation_date', 'description', 'line_items', 'link',