@@ -51,13 +58,37 @@
{% block js_ready %}
{{ block.super }}
- $("#part-create").click(function () {
+ $("#manufacturer-part-create").click(function () {
+ launchModalForm(
+ "{% url 'manufacturer-part-create' %}",
+ {
+ data: {
+ manufacturer: {{ company.id }},
+ },
+ reload: true,
+ secondary: [
+ {
+ field: 'part',
+ label: '{% trans "New Part" %}',
+ title: '{% trans "Create new Part" %}',
+ url: "{% url 'part-create' %}"
+ },
+ {
+ field: 'manufacturer',
+ label: '{% trans "New Manufacturer" %}',
+ title: '{% trans "Create new Manufacturer" %}',
+ url: "{% url 'manufacturer-create' %}",
+ },
+ ]
+ });
+ });
+
+ $("#supplier-part-create").click(function () {
launchModalForm(
"{% url 'supplier-part-create' %}",
{
data: {
- {% if company.is_supplier %}supplier: {{ company.id }},{% endif %}
- {% if company.is_manufacturer %}manufacturer: {{ company.id }},{% endif %}
+ supplier: {{ company.id }},
},
reload: true,
secondary: [
@@ -73,16 +104,25 @@
title: "{% trans 'Create new Supplier' %}",
url: "{% url 'supplier-create' %}",
},
- {
- field: 'manufacturer',
- label: '{% trans "New Manufacturer" %}',
- title: '{% trans "Create new Manufacturer" %}',
- url: "{% url 'manufacturer-create' %}",
- },
]
});
});
+ {% if company.is_manufacturer %}
+ loadManufacturerPartTable(
+ "#part-table",
+ "{% url 'api-manufacturer-part-list' %}",
+ {
+ params: {
+ part_detail: true,
+ manufacturer_detail: true,
+ company: {{ company.id }},
+ },
+ }
+ );
+ {% endif %}
+
+ {% if company.is_supplier %}
loadSupplierPartTable(
"#part-table",
"{% url 'api-supplier-part-list' %}",
@@ -95,6 +135,7 @@
},
}
);
+ {% endif %}
$("#multi-part-delete").click(function() {
var selections = $("#part-table").bootstrapTable("getSelections");
@@ -105,7 +146,14 @@
parts.push(item.pk);
});
- launchModalForm("{% url 'supplier-part-delete' %}", {
+ {% if company.is_manufacturer %}
+ var url = "{% url 'manufacturer-part-delete' %}"
+ {% endif %}
+ {% if company.is_supplier %}
+ var url = "{% url 'supplier-part-delete' %}"
+ {% endif %}
+
+ launchModalForm(url, {
data: {
parts: parts,
},
diff --git a/InvenTree/company/templates/company/navbar.html b/InvenTree/company/templates/company/navbar.html
index bddd29a8b5..0527eb925e 100644
--- a/InvenTree/company/templates/company/navbar.html
+++ b/InvenTree/company/templates/company/navbar.html
@@ -16,14 +16,25 @@
- {% if company.is_supplier or company.is_manufacturer %}
+ {% if company.is_manufacturer %}
+
+
+
+ {% trans "Parts" %}
+
+
+ {% endif %}
+
+ {% if company.is_supplier %}
{% trans "Parts" %}
+ {% endif %}
+ {% if company.is_manufacturer or company.is_supplier %}
diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py
index cdaca6a9e3..015e5e248c 100644
--- a/InvenTree/company/views.py
+++ b/InvenTree/company/views.py
@@ -352,7 +352,7 @@ class ManufacturerPartEdit(AjaxUpdateView):
model = ManufacturerPart
context_object_name = 'part'
- form_class = EditSupplierPartForm
+ form_class = EditManufacturerPartForm
ajax_template_name = 'modal_form.html'
ajax_form_title = _('Edit Manufacturer Part')