mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Specify a unique parent node that cannot shadow an existing pk
This commit is contained in:
parent
a56d7836d0
commit
0375d5b940
@ -81,15 +81,17 @@ function loadStockTestResultsTable(table, options) {
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parent_node = "parent node";
|
||||||
|
|
||||||
table.inventreeTable({
|
table.inventreeTable({
|
||||||
url: "{% url 'api-part-test-template-list' %}",
|
url: "{% url 'api-part-test-template-list' %}",
|
||||||
method: 'get',
|
method: 'get',
|
||||||
name: 'testresult',
|
name: 'testresult',
|
||||||
treeEnable: true,
|
treeEnable: true,
|
||||||
rootParentId: options.stock_item,
|
rootParentId: parent_node,
|
||||||
parentIdField: 'parent',
|
parentIdField: 'parent',
|
||||||
idField: 'pk',
|
idField: 'pk',
|
||||||
uniqueId: 'pk',
|
uniqueId: 'key',
|
||||||
treeShowField: 'test_name',
|
treeShowField: 'test_name',
|
||||||
formatNoMatches: function() {
|
formatNoMatches: function() {
|
||||||
return '{% trans "No test results found" %}';
|
return '{% trans "No test results found" %}';
|
||||||
@ -190,7 +192,7 @@ function loadStockTestResultsTable(table, options) {
|
|||||||
match = true;
|
match = true;
|
||||||
|
|
||||||
if (row.result == null) {
|
if (row.result == null) {
|
||||||
item.parent = options.stock_item;
|
item.parent = parent_node;
|
||||||
tableData[index] = item;
|
tableData[index] = item;
|
||||||
override = true;
|
override = true;
|
||||||
} else {
|
} else {
|
||||||
@ -202,7 +204,7 @@ function loadStockTestResultsTable(table, options) {
|
|||||||
// No match could be found
|
// No match could be found
|
||||||
if (!match) {
|
if (!match) {
|
||||||
item.test_name = item.test;
|
item.test_name = item.test;
|
||||||
item.parent = options.stock_item;
|
item.parent = parent_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!override) {
|
if (!override) {
|
||||||
|
Loading…
Reference in New Issue
Block a user