diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index f1f8f632e5..c303c55d17 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -1884,7 +1884,7 @@ function constructChoiceInput(name, parameters) { */ function constructRelatedFieldInput(name) { - var html = ``; + var html = ``; // Don't load any options - they will be filled via an AJAX request diff --git a/InvenTree/templates/js/translated/model_renderers.js b/InvenTree/templates/js/translated/model_renderers.js index eeb3cdbad2..86a12013a2 100644 --- a/InvenTree/templates/js/translated/model_renderers.js +++ b/InvenTree/templates/js/translated/model_renderers.js @@ -37,7 +37,7 @@ function renderCompany(name, data, parameters, options) { html += `${data.name} - ${data.description}`; - html += `{% trans "Company ID" %}: ${data.pk}`; + html += `{% trans "Company ID" %}: ${data.pk}`; return html; } @@ -53,8 +53,8 @@ function renderStockItem(name, data, parameters, options) { var render_part_detail = true; - if ("render_part_detail" in parameters) { - render_part_detail = parameters["render_part_detail"]; + if ('render_part_detail' in parameters) { + render_part_detail = parameters['render_part_detail']; } if (render_part_detail) { @@ -62,24 +62,38 @@ function renderStockItem(name, data, parameters, options) { html += ` ${data.part_detail.full_name || data.part_detail.name}`; } + html += ''; + if (data.serial && data.quantity == 1) { - html += ` - {% trans "Serial Number" %}: ${data.serial}`; + html += `{% trans "Serial Number" %}: ${data.serial}`; } else { - html += ` - {% trans "Quantity" %}: ${data.quantity}`; + html += `{% trans "Quantity" %}: ${data.quantity}`; } + html += ''; + if (render_part_detail && data.part_detail.description) { html += `
${data.part_detail.description}
`; } + var render_stock_id = true; + + if ('render_stock_id' in parameters) { + render_stock_id = parameters['render_stock_id']; + } + + if (render_stock_id) { + html += `{% trans "Stock ID" %}: ${data.pk}`; + } + var render_location_detail = false; - if ("render_location_detail" in parameters) { - render_location_detail = parameters["render_location_detail"]; + if ('render_location_detail' in parameters) { + render_location_detail = parameters['render_location_detail']; } if (render_location_detail && data.location_detail) { - html += `${data.location_detail.pathstring}
`; + html += ` - ${data.location_detail.name}`; } return html; @@ -98,7 +112,7 @@ function renderStockLocation(name, data, parameters, options) { html += ` - ${data.description}`; } - html += `{% trans "Location ID" %}: ${data.pk}`; + html += `{% trans "Location ID" %}: ${data.pk}`; return html; } @@ -115,7 +129,7 @@ function renderBuild(name, data, parameters, options) { var html = select2Thumbnail(image); html += `${data.reference} - ${data.quantity} x ${data.part_detail.full_name}`; - html += `{% trans "Build ID" %}: ${data.pk}`; + html += `{% trans "Build ID" %}: ${data.pk}`; html += `${data.title}
`; @@ -135,7 +149,7 @@ function renderPart(name, data, parameters, options) { html += ` - ${data.description}`; } - html += `{% trans "Part ID" %}: ${data.pk}`; + html += `{% trans "Part ID" %}: ${data.pk}`; return html; } @@ -187,7 +201,7 @@ function renderPartCategory(name, data, parameters, options) { html += ` - ${data.description}`; } - html += `{% trans "Category ID" %}: ${data.pk}`; + html += `{% trans "Category ID" %}: ${data.pk}`; return html; } @@ -224,7 +238,7 @@ function renderManufacturerPart(name, data, parameters, options) { html += ` ${data.manufacturer_detail.name} - ${data.MPN}`; html += ` - ${data.part_detail.full_name}`; - html += `{% trans "Manufacturer Part ID" %}: ${data.pk}`; + html += `{% trans "Manufacturer Part ID" %}: ${data.pk}`; return html; } @@ -253,7 +267,7 @@ function renderSupplierPart(name, data, parameters, options) { html += ` ${data.supplier_detail.name} - ${data.SKU}`; html += ` - ${data.part_detail.full_name}`; - html += `{% trans "Supplier Part ID" %}: ${data.pk}`; + html += `{% trans "Supplier Part ID" %}: ${data.pk}`; return html;