mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into part-import
This commit is contained in:
@ -34,6 +34,9 @@
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_COPY_TESTS" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_CATEGORY_PARAMETERS" %}
|
||||
<tr><td colspan='5'></td></tr>
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_INTERNAL_PRICE" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_BOM_USE_INTERNAL_PRICE" %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -155,6 +155,88 @@ function makeBuildOutputActionButtons(output, buildInfo, lines) {
|
||||
}
|
||||
|
||||
|
||||
function loadBuildOrderAllocationTable(table, options={}) {
|
||||
/**
|
||||
* Load a table showing all the BuildOrder allocations for a given part
|
||||
*/
|
||||
|
||||
options.params['part_detail'] = true;
|
||||
options.params['build_detail'] = true;
|
||||
options.params['location_detail'] = true;
|
||||
|
||||
var filters = loadTableFilters("buildorderallocation");
|
||||
|
||||
for (var key in options.params) {
|
||||
filters[key] = options.params[key];
|
||||
}
|
||||
|
||||
setupFilterList("buildorderallocation", $(table));
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: '{% url "api-build-item-list" %}',
|
||||
queryParams: filters,
|
||||
name: 'buildorderallocation',
|
||||
groupBy: false,
|
||||
search: false,
|
||||
paginationVAlign: 'bottom',
|
||||
original: options.params,
|
||||
formatNoMatches: function() {
|
||||
return '{% trans "No build order allocations found" %}'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'pk',
|
||||
visible: false,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
field: 'build',
|
||||
switchable: false,
|
||||
title: '{% trans "Build Order" %}',
|
||||
formatter: function(value, row) {
|
||||
var prefix = "{% settings_value 'BUILDORDER_REFERENCE_PREFIX' %}";
|
||||
|
||||
var ref = `${prefix}${row.build_detail.reference}`;
|
||||
|
||||
return renderLink(ref, `/build/${row.build}/`);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'item',
|
||||
title: '{% trans "Stock Item" %}',
|
||||
formatter: function(value, row) {
|
||||
// Render a link to the particular stock item
|
||||
|
||||
var link = `/stock/item/${row.stock_item}/`;
|
||||
var text = `{% trans "Stock Item" %} ${row.stock_item}`;
|
||||
|
||||
return renderLink(text, link);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'location',
|
||||
title: '{% trans "Location" %}',
|
||||
formatter: function(value, row) {
|
||||
|
||||
if (!value) {
|
||||
return '{% trans "Location not specified" %}';
|
||||
}
|
||||
|
||||
var link = `/stock/location/${value}`;
|
||||
var text = row.location_detail.description;
|
||||
|
||||
return renderLink(text, link);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: '{% trans "Quantity" %}',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
/*
|
||||
* Load the "allocation table" for a particular build output.
|
||||
@ -347,6 +429,8 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
|
||||
var params = {
|
||||
build: buildId,
|
||||
part_detail: true,
|
||||
location_detail: true,
|
||||
}
|
||||
|
||||
if (output) {
|
||||
@ -466,8 +550,8 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
title: '{% trans "Part" %}',
|
||||
formatter: function(value, row) {
|
||||
|
||||
var html = imageHoverIcon(row.part_thumb);
|
||||
html += renderLink(row.part_name, `/part/${value}/`);
|
||||
var html = imageHoverIcon(row.part_detail.thumbnail);
|
||||
html += renderLink(row.part_detail.full_name, `/part/${value}/`);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
|
@ -775,7 +775,9 @@ function handleModalForm(url, options) {
|
||||
}
|
||||
// Form was returned, invalid!
|
||||
else {
|
||||
if (!response.hideErrorMessage && !options.hideErrorMessage) {
|
||||
|
||||
// Disable error message with option or response
|
||||
if (!options.hideErrorMessage && !response.hideErrorMessage) {
|
||||
var warningDiv = $(modal).find('#form-validation-warning');
|
||||
warningDiv.css('display', 'block');
|
||||
}
|
||||
@ -791,13 +793,16 @@ function handleModalForm(url, options) {
|
||||
attachSecondaries(modal, options.secondary);
|
||||
}
|
||||
|
||||
// Set modal title with response
|
||||
if (response.title) {
|
||||
modalSetTitle(modal, response.title);
|
||||
}
|
||||
|
||||
// Clean custom action buttons
|
||||
$(modal).find('#modal-footer-buttons').html('');
|
||||
|
||||
// Add custom action buttons with response
|
||||
if (response.buttons) {
|
||||
// Clean custom action buttons
|
||||
$(modal).find('#modal-footer-buttons').html('');
|
||||
attachButtons(modal, response.buttons);
|
||||
}
|
||||
}
|
||||
@ -846,6 +851,7 @@ function launchModalForm(url, options = {}) {
|
||||
* secondary - List of secondary modals to attach
|
||||
* callback - List of callback functions to attach to inputs
|
||||
* focus - Select which field to focus on by default
|
||||
* buttons - additional buttons that should be added as array with [name, title]
|
||||
*/
|
||||
|
||||
var modal = options.modal || '#modal-form';
|
||||
@ -905,6 +911,11 @@ function launchModalForm(url, options = {}) {
|
||||
attachButtons(modal, options.buttons);
|
||||
}
|
||||
|
||||
// Add custom buttons from response
|
||||
if (response.buttons) {
|
||||
attachButtons(modal, response.buttons);
|
||||
}
|
||||
|
||||
} else {
|
||||
$(modal).modal('hide');
|
||||
showAlertDialog('{% trans "Invalid server response" %}', '{% trans "JSON response missing form data" %}');
|
||||
|
@ -310,3 +310,88 @@ function loadSalesOrderTable(table, options) {
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadSalesOrderAllocationTable(table, options={}) {
|
||||
/**
|
||||
* Load a table with SalesOrderAllocation items
|
||||
*/
|
||||
|
||||
options.params = options.params || {};
|
||||
|
||||
options.params['location_detail'] = true;
|
||||
options.params['part_detail'] = true;
|
||||
options.params['item_detail'] = true;
|
||||
options.params['order_detail'] = true;
|
||||
|
||||
var filters = loadTableFilters("salesorderallocation");
|
||||
|
||||
for (var key in options.params) {
|
||||
filters[key] = options.params[key];
|
||||
}
|
||||
|
||||
setupFilterList("salesorderallocation", $(table));
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: '{% url "api-so-allocation-list" %}',
|
||||
queryParams: filters,
|
||||
name: 'salesorderallocation',
|
||||
groupBy: false,
|
||||
search: false,
|
||||
paginationVAlign: 'bottom',
|
||||
original: options.params,
|
||||
formatNoMatches: function() { return '{% trans "No sales order allocations found" %}'; },
|
||||
columns: [
|
||||
{
|
||||
field: 'pk',
|
||||
visible: false,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
field: 'order',
|
||||
switchable: false,
|
||||
title: '{% trans "Order" %}',
|
||||
switchable: false,
|
||||
formatter: function(value, row) {
|
||||
|
||||
var prefix = "{% settings_value 'SALESORDER_REFERENCE_PREFIX' %}";
|
||||
|
||||
var ref = `${prefix}${row.order_detail.reference}`;
|
||||
|
||||
return renderLink(ref, `/order/sales-order/${row.order}/`);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'item',
|
||||
title: '{% trans "Stock Item" %}',
|
||||
formatter: function(value, row) {
|
||||
// Render a link to the particular stock item
|
||||
|
||||
var link = `/stock/item/${row.item}/`;
|
||||
var text = `{% trans "Stock Item" %} ${row.item}`;
|
||||
|
||||
return renderLink(text, link);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'location',
|
||||
title: '{% trans "Location" %}',
|
||||
formatter: function(value, row) {
|
||||
|
||||
if (!value) {
|
||||
return '{% trans "Location not specified" %}';
|
||||
}
|
||||
|
||||
var link = `/stock/location/${value}`;
|
||||
var text = row.location_detail.description;
|
||||
|
||||
return renderLink(text, link);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: '{% trans "Quantity" %}',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
@ -159,7 +159,7 @@ function loadStockTestResultsTable(table, options) {
|
||||
|
||||
// Set "parent" for each existing row
|
||||
tableData.forEach(function(item, idx) {
|
||||
tableData[idx].parent = options.stock_item;
|
||||
tableData[idx].parent = parent_node;
|
||||
});
|
||||
|
||||
// Once the test template data are loaded, query for test results
|
||||
@ -660,6 +660,11 @@ function loadStockTable(table, options) {
|
||||
title: '{% trans "Last Updated" %}',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'purchase_price',
|
||||
title: '{% trans "Purchase Price" %}',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'packaging',
|
||||
title: '{% trans "Packaging" %}',
|
||||
|
@ -135,7 +135,7 @@ $.fn.inventreeTable = function(options) {
|
||||
|
||||
// Pagingation options (can be server-side or client-side as specified by the caller)
|
||||
options.pagination = true;
|
||||
options.paginationVAlign = 'both';
|
||||
options.paginationVAlign = options.paginationVAlign || 'both';
|
||||
options.pageSize = inventreeLoad(varName, 25);
|
||||
options.pageList = [25, 50, 100, 250, 'all'];
|
||||
options.totalField = 'count';
|
||||
|
Reference in New Issue
Block a user