diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py index 7cd4c0a858..be7d326c36 100644 --- a/InvenTree/company/views.py +++ b/InvenTree/company/views.py @@ -542,6 +542,10 @@ class SupplierPartEdit(AjaxUpdateView): supplier_part = self.get_object() + # Hide Manufacturer fields + form.fields['manufacturer'].widget = HiddenInput() + form.fields['MPN'].widget = HiddenInput() + # It appears that hiding a MoneyField fails validation # Therefore the idea to set the value before hiding if form.is_valid(): diff --git a/InvenTree/templates/js/company.js b/InvenTree/templates/js/company.js index 27115f19e1..d258c8bab1 100644 --- a/InvenTree/templates/js/company.js +++ b/InvenTree/templates/js/company.js @@ -306,7 +306,11 @@ function loadSupplierPartTable(table, url, options) { field: 'MPN', title: '{% trans "MPN" %}', formatter: function(value, row, index, field) { - return renderLink(value, `/manufacturer-part/${row.manufacturer_part.pk}/`); + if (value && row.manufacturer_part) { + return renderLink(value, `/manufacturer-part/${row.manufacturer_part.pk}/`); + } else { + return "-"; + } } }, {