mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2727 from SchrodingersGat/build-allocation-load-speed
Bug fixes for build output creation
This commit is contained in:
commit
dd5cda281e
@ -715,7 +715,7 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
||||
build=self,
|
||||
bom_item=bom_item,
|
||||
stock_item=stock_item,
|
||||
quantity=quantity,
|
||||
quantity=1,
|
||||
install_into=output,
|
||||
)
|
||||
|
||||
|
@ -323,16 +323,7 @@
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
$('#btn-create-output').click(function() {
|
||||
|
||||
createBuildOutput(
|
||||
{{ build.pk }},
|
||||
{
|
||||
trackable_parts: {% if build.part.has_trackable_parts %}true{% else %}false{% endif%},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
onPanelLoad('completed', function() {
|
||||
loadStockTable($("#build-stock-table"), {
|
||||
params: {
|
||||
location_detail: true,
|
||||
@ -346,7 +337,66 @@ loadStockTable($("#build-stock-table"), {
|
||||
],
|
||||
url: "{% url 'api-stock-list' %}",
|
||||
});
|
||||
});
|
||||
|
||||
onPanelLoad('children', function() {
|
||||
loadBuildTable($('#sub-build-table'), {
|
||||
url: '{% url "api-build-list" %}',
|
||||
filterTarget: "#filter-list-sub-build",
|
||||
params: {
|
||||
ancestor: {{ build.pk }},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onPanelLoad('attachments', function() {
|
||||
|
||||
enableDragAndDrop(
|
||||
'#attachment-dropzone',
|
||||
'{% url "api-build-attachment-list" %}',
|
||||
{
|
||||
data: {
|
||||
build: {{ build.id }},
|
||||
},
|
||||
label: 'attachment',
|
||||
success: function(data, status, xhr) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
loadAttachmentTable('{% url "api-build-attachment-list" %}', {
|
||||
filters: {
|
||||
build: {{ build.pk }},
|
||||
},
|
||||
fields: {
|
||||
build: {
|
||||
value: {{ build.pk }},
|
||||
hidden: true,
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onPanelLoad('notes', function() {
|
||||
$('#edit-notes').click(function() {
|
||||
constructForm('{% url "api-build-detail" build.pk %}', {
|
||||
fields: {
|
||||
notes: {
|
||||
multiline: true,
|
||||
}
|
||||
},
|
||||
title: '{% trans "Edit Notes" %}',
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function reloadTable() {
|
||||
$('#allocation-table-untracked').bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
onPanelLoad('allocate', function() {
|
||||
|
||||
// Get the list of BOM items required for this build
|
||||
inventreeGet(
|
||||
@ -436,57 +486,16 @@ inventreeGet(
|
||||
}
|
||||
);
|
||||
|
||||
loadBuildTable($('#sub-build-table'), {
|
||||
url: '{% url "api-build-list" %}',
|
||||
filterTarget: "#filter-list-sub-build",
|
||||
params: {
|
||||
ancestor: {{ build.pk }},
|
||||
}
|
||||
});
|
||||
$('#btn-create-output').click(function() {
|
||||
|
||||
|
||||
enableDragAndDrop(
|
||||
'#attachment-dropzone',
|
||||
'{% url "api-build-attachment-list" %}',
|
||||
createBuildOutput(
|
||||
{{ build.pk }},
|
||||
{
|
||||
data: {
|
||||
build: {{ build.id }},
|
||||
},
|
||||
label: 'attachment',
|
||||
success: function(data, status, xhr) {
|
||||
location.reload();
|
||||
}
|
||||
trackable_parts: {% if build.part.has_trackable_parts %}true{% else %}false{% endif%},
|
||||
}
|
||||
);
|
||||
|
||||
loadAttachmentTable('{% url "api-build-attachment-list" %}', {
|
||||
filters: {
|
||||
build: {{ build.pk }},
|
||||
},
|
||||
fields: {
|
||||
build: {
|
||||
value: {{ build.pk }},
|
||||
hidden: true,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#edit-notes').click(function() {
|
||||
constructForm('{% url "api-build-detail" build.pk %}', {
|
||||
fields: {
|
||||
notes: {
|
||||
multiline: true,
|
||||
}
|
||||
},
|
||||
title: '{% trans "Edit Notes" %}',
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
function reloadTable() {
|
||||
$('#allocation-table-untracked').bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
{% if build.active %}
|
||||
|
||||
$("#btn-auto-allocate").on('click', function() {
|
||||
@ -575,8 +584,8 @@ $("#btn-order-parts").click(function() {
|
||||
});
|
||||
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
enableSidebar('buildorder');
|
||||
|
||||
|
||||
{% endblock %}
|
@ -23,7 +23,7 @@ class CommonConfig(AppConfig):
|
||||
try:
|
||||
import common.models
|
||||
|
||||
if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED'):
|
||||
if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED', backup_value=False, create=False):
|
||||
logger.info("Clearing SERVER_RESTART_REQUIRED flag")
|
||||
common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
|
||||
except:
|
||||
|
@ -268,6 +268,10 @@ class BaseInvenTreeSetting(models.Model):
|
||||
# Setting does not exist! (Try to create it)
|
||||
if not setting:
|
||||
|
||||
# Unless otherwise specified, attempt to create the setting
|
||||
create = kwargs.get('create', True)
|
||||
|
||||
if create:
|
||||
# Attempt to create a new settings object
|
||||
setting = cls(
|
||||
key=key,
|
||||
|
Loading…
Reference in New Issue
Block a user