diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index a01b05034f..3b91d27c81 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -23,6 +23,7 @@ from djmoney.money import Money from djmoney.contrib.exchange.models import convert_money from djmoney.contrib.exchange.exceptions import MissingRate +from decimal import Decimal from .models import Part, PartCategory, BomItem from .models import PartParameter, PartParameterTemplate @@ -30,6 +31,7 @@ from .models import PartAttachment, PartTestTemplate from .models import PartSellPriceBreak, PartInternalPriceBreak from .models import PartCategoryParameterTemplate +from stock.models import StockItem from common.models import InvenTreeSetting from build.models import Build diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 46b2b21a87..27337d97e7 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -564,7 +564,7 @@ function submitFormData(fields, options) { var has_files = false; // Extract values for each field - for (var idx = 0; idx < options.fields_names.length; idx++) { + for (var idx = 0; idx < options.field_names.length; idx++) { var name = options.field_names[idx]; diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index aaee9e47a0..fafdaa94e7 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -13,6 +13,116 @@ function yesNoLabel(value) { } } +// Construct fieldset for part forms +function partFields(options={}) { + + var fields = { + category: {}, + name: {}, + IPN: {}, + revision: {}, + description: {}, + variant_of: {}, + keywords: { + icon: 'fa-key', + }, + units: {}, + link: { + icon: 'fa-link', + }, + default_location: {}, + default_supplier: {}, + default_expiry: { + icon: 'fa-calendar-alt', + }, + minimum_stock: { + icon: 'fa-boxes', + }, + attributes: { + type: 'candy', + html: `