2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Merge branch 'master' into feature-non-int-serial

This commit is contained in:
Ben Charlton
2020-08-28 17:14:02 +01:00
17 changed files with 412 additions and 108 deletions

View File

@ -237,7 +237,7 @@ class TestReportFormatForm(HelperForm):
for template in templates:
if template.matches_stock_item(self.stock_item):
choices.append(template)
choices.append((template.pk, template))
return choices

View File

@ -320,15 +320,12 @@ $("#print-label").click(function() {
});
$("#stock-duplicate").click(function() {
launchModalForm(
"{% url 'stock-item-create' %}",
{
follow: true,
data: {
copy: {{ item.id }},
},
createNewStockItem({
follow: true,
data: {
copy: {{ item.id }},
}
);
});
});
$("#stock-edit").click(function () {

View File

@ -204,38 +204,14 @@
{% endif %}
$('#item-create').click(function () {
launchModalForm("{% url 'stock-item-create' %}",
{
follow: true,
data: {
{% if location %}
location: {{ location.id }}
{% endif %}
},
secondary: [
{
field: 'part',
label: 'New Part',
title: 'Create New Part',
url: "{% url 'part-create' %}",
},
{
field: 'supplier_part',
label: 'New Supplier Part',
title: 'Create new Supplier Part',
url: "{% url 'supplier-part-create' %}"
},
{
field: 'location',
label: 'New Location',
title: 'Create New Location',
url: "{% url 'stock-location-create' %}",
}
]
});
return false;
createNewStockItem({
follow: true,
data: {
{% if location %}
location: {{ location.id }}
{% endif %}
}
});
});
loadStockTable($("#stock-table"), {

View File

@ -1240,7 +1240,7 @@ class StockItemCreate(AjaxCreateView):
form.rebuild_layout()
# Hide the 'part' field (as a valid part is selected)
form.fields['part'].widget = HiddenInput()
# form.fields['part'].widget = HiddenInput()
# trackable parts get special consideration
if part.trackable:
@ -1267,6 +1267,11 @@ class StockItemCreate(AjaxCreateView):
# TODO - This does NOT work for some reason? Ref build.views.BuildItemCreate
form.fields['supplier_part'].initial = all_parts[0].id
else:
# No Part has been selected!
# We must not provide *any* options for SupplierPart
form.fields['supplier_part'].queryset = SupplierPart.objects.none()
# Otherwise if the user has selected a SupplierPart, we know what Part they meant!
if form['supplier_part'].value() is not None:
pass