diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js index eaa1d40d3d..7d7fe6ab28 100644 --- a/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/static/script/inventree/bom.js @@ -89,11 +89,11 @@ function loadBomTable(table, options) { // Part column cols.push( { - field: 'sub_part_detail', + field: 'sub_part_detail.full_name', title: 'Part', sortable: true, formatter: function(value, row, index, field) { - return imageHoverIcon(value.image_url) + renderLink(value.full_name, value.url); + return imageHoverIcon(row.sub_part_detail.image_url) + renderLink(row.sub_part_detail.full_name, row.sub_part_detail.url); } } ); @@ -115,29 +115,8 @@ function loadBomTable(table, options) { sortable: true, } ); - - // Part notes - cols.push( - { - field: 'note', - title: 'Notes', - searchable: true, - sortable: true, - } - ); - if (options.editable) { - cols.push({ - formatter: function(value, row, index, field) { - var bEdit = ""; - var bDelt = ""; - - return "
" + bEdit + bDelt + "
"; - } - }); - } - - else { + if (!options.editable) { cols.push( { field: 'sub_part_detail.available_stock', @@ -161,6 +140,27 @@ function loadBomTable(table, options) { } ); } + + // Part notes + cols.push( + { + field: 'note', + title: 'Notes', + searchable: true, + sortable: true, + } + ); + + if (options.editable) { + cols.push({ + formatter: function(value, row, index, field) { + var bEdit = ""; + var bDelt = ""; + + return "
" + bEdit + bDelt + "
"; + } + }); + } // Configure the table (bootstrap-table) @@ -172,6 +172,7 @@ function loadBomTable(table, options) { queryParams: function(p) { return { part: options.parent_id, + ordering: 'name', } }, columns: cols,