Fix rendering of PurchaseOrder table

This commit is contained in:
Oliver Walters 2020-04-20 09:48:33 +10:00
parent 99fcbcc646
commit 746e9ab983
2 changed files with 14 additions and 9 deletions

View File

@ -104,21 +104,23 @@ function removePurchaseOrderLineItem(e) {
function loadPurchaseOrderTable(table, options) { function loadPurchaseOrderTable(table, options) {
/* Create a purchase-order table */ /* Create a purchase-order table */
var params = options.params || {}; options.params = options.params || {};
options.params['supplier_detail'] = true;
var filters = loadTableFilters("order"); var filters = loadTableFilters("order");
for (var key in params) { for (var key in options.params) {
filters[key] = params[key]; filters[key] = options.params[key];
} }
setupFilterList("order", table); setupFilterList("order", $(table));
$(table).inventreeTable({ $(table).inventreeTable({
url: options.url, url: options.url,
queryParams: filters, queryParams: filters,
groupBy: false, groupBy: false,
original: params, original: options.params,
formatNoMatches: function() { return "No purchase orders found"; }, formatNoMatches: function() { return "No purchase orders found"; },
columns: [ columns: [
{ {
@ -131,15 +133,15 @@ function loadPurchaseOrderTable(table, options) {
field: 'reference', field: 'reference',
title: 'Purchase Order', title: 'Purchase Order',
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return renderLink(value, "/order/purchase-order/" + row.pk + "/"); return renderLink(value, `/order/purchase-order/${row.pk}/`);
} }
}, },
{ {
sortable: true, sortable: true,
field: 'supplier', field: 'supplier_detail',
title: 'Supplier', title: 'Supplier',
formatter: function(value, row, index, field) { 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, sortable: true,
field: 'lines', field: 'line_items',
title: 'Items' title: 'Items'
}, },
], ],

View File

@ -48,6 +48,9 @@ class POSerializer(InvenTreeModelSerializer):
fields = [ fields = [
'pk', 'pk',
'issue_date',
'complete_date',
'creation_date',
'description', 'description',
'line_items', 'line_items',
'link', 'link',