mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
commit
aacc7119bd
@ -336,7 +336,7 @@ class PartStarSerializer(InvenTreeModelSerializer):
|
|||||||
class BomItemSerializer(InvenTreeModelSerializer):
|
class BomItemSerializer(InvenTreeModelSerializer):
|
||||||
""" Serializer for BomItem object """
|
""" Serializer for BomItem object """
|
||||||
|
|
||||||
price_range = serializers.CharField(read_only=True)
|
# price_range = serializers.CharField(read_only=True)
|
||||||
|
|
||||||
quantity = serializers.FloatField()
|
quantity = serializers.FloatField()
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
|||||||
'sub_part_detail',
|
'sub_part_detail',
|
||||||
'quantity',
|
'quantity',
|
||||||
'reference',
|
'reference',
|
||||||
'price_range',
|
# 'price_range',
|
||||||
'optional',
|
'optional',
|
||||||
'overage',
|
'overage',
|
||||||
'note',
|
'note',
|
||||||
|
@ -140,6 +140,12 @@ function loadBomTable(table, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the parent ID of the multi-level table.
|
||||||
|
// We prepend this with the literal string value 'top-level-',
|
||||||
|
// because otherwise the unfortunate situation where BomItem.pk == BomItem.part.pk
|
||||||
|
// AND THIS BREAKS EVERYTHING
|
||||||
|
var parent_id = `top-level-${options.parent_id}`;
|
||||||
|
|
||||||
// Part column
|
// Part column
|
||||||
cols.push(
|
cols.push(
|
||||||
{
|
{
|
||||||
@ -197,11 +203,11 @@ function loadBomTable(table, options) {
|
|||||||
text = parseFloat(text);
|
text = parseFloat(text);
|
||||||
|
|
||||||
if (row.optional) {
|
if (row.optional) {
|
||||||
text += " ({% trans "Optional" %})";
|
text += ' ({% trans "Optional" %})';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row.overage) {
|
if (row.overage) {
|
||||||
text += "<small> (+" + row.overage + ") </small>";
|
text += `<small> (${row.overage}) </small>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@ -228,6 +234,12 @@ function loadBomTable(table, options) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
// TODO - Re-introduce the pricing column at a later stage,
|
||||||
|
// once the pricing has been "fixed"
|
||||||
|
// O.W. 2020-11-24
|
||||||
|
|
||||||
cols.push(
|
cols.push(
|
||||||
{
|
{
|
||||||
field: 'price_range',
|
field: 'price_range',
|
||||||
@ -241,6 +253,7 @@ function loadBomTable(table, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part notes
|
// Part notes
|
||||||
@ -327,9 +340,8 @@ function loadBomTable(table, options) {
|
|||||||
|
|
||||||
table.inventreeTable({
|
table.inventreeTable({
|
||||||
treeEnable: !options.editable,
|
treeEnable: !options.editable,
|
||||||
rootParentId: options.parent_id,
|
rootParentId: parent_id,
|
||||||
idField: 'pk',
|
idField: 'pk',
|
||||||
//uniqueId: 'pk',
|
|
||||||
parentIdField: 'parentId',
|
parentIdField: 'parentId',
|
||||||
treeShowField: 'sub_part',
|
treeShowField: 'sub_part',
|
||||||
showColumns: true,
|
showColumns: true,
|
||||||
@ -338,12 +350,18 @@ function loadBomTable(table, options) {
|
|||||||
search: true,
|
search: true,
|
||||||
rowStyle: function(row, index) {
|
rowStyle: function(row, index) {
|
||||||
if (row.validated) {
|
if (row.validated) {
|
||||||
return {classes: 'rowvalid'};
|
return {
|
||||||
|
classes: 'rowvalid'
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return {classes: 'rowinvalid'};
|
return {
|
||||||
|
classes: 'rowinvalid'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatNoMatches: function() { return '{% trans "No BOM items found" %}'; },
|
formatNoMatches: function() {
|
||||||
|
return '{% trans "No BOM items found" %}';
|
||||||
|
},
|
||||||
clickToSelect: true,
|
clickToSelect: true,
|
||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
original: params,
|
original: params,
|
||||||
@ -376,7 +394,7 @@ function loadBomTable(table, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the parent ID of the top-level rows
|
// Set the parent ID of the top-level rows
|
||||||
row.parentId = options.parent_id;
|
row.parentId = parent_id;
|
||||||
|
|
||||||
table.bootstrapTable('updateRow', idx, row, true);
|
table.bootstrapTable('updateRow', idx, row, true);
|
||||||
|
|
||||||
|
10
tasks.py
10
tasks.py
@ -102,6 +102,16 @@ def install(c):
|
|||||||
print("Config file 'config.yaml' does not exist - copying from template.")
|
print("Config file 'config.yaml' does not exist - copying from template.")
|
||||||
copyfile(CONFIG_TEMPLATE_FILE, CONFIG_FILE)
|
copyfile(CONFIG_TEMPLATE_FILE, CONFIG_FILE)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def shell(c):
|
||||||
|
"""
|
||||||
|
Open a python shell with access to the InvenTree database models.
|
||||||
|
"""
|
||||||
|
|
||||||
|
manage(c, 'shell', pty=True)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def superuser(c):
|
def superuser(c):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user