From 2b1d8f5b79b6643fe3b2af210490b8327f6499c2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 6 Jun 2022 13:00:30 +1000 Subject: [PATCH] Set part category (#3134) * Refactor function to enable / disable submit button on modal forms * Category selection now just uses the AP * Remove unused forms / views * JS linting fixes * remove outdated unit test --- InvenTree/part/forms.py | 11 +-- InvenTree/part/templates/part/category.html | 3 +- .../part/templates/part/set_category.html | 43 ----------- InvenTree/part/test_views.py | 20 ----- InvenTree/part/urls.py | 3 - InvenTree/part/views.py | 75 ------------------ InvenTree/templates/js/translated/bom.js | 2 +- InvenTree/templates/js/translated/forms.js | 10 +-- InvenTree/templates/js/translated/modals.js | 32 ++++---- InvenTree/templates/js/translated/part.js | 77 +++++++++++++++---- 10 files changed, 91 insertions(+), 185 deletions(-) delete mode 100644 InvenTree/part/templates/part/set_category.html diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index fa9983cf3e..8808265412 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -3,15 +3,12 @@ from django import forms from django.utils.translation import gettext_lazy as _ -from mptt.fields import TreeNodeChoiceField - from common.forms import MatchItemForm from InvenTree.fields import RoundingDecimalFormField from InvenTree.forms import HelperForm from InvenTree.helpers import clean_decimal -from .models import (Part, PartCategory, PartInternalPriceBreak, - PartSellPriceBreak) +from .models import Part, PartInternalPriceBreak, PartSellPriceBreak class PartImageDownloadForm(HelperForm): @@ -53,12 +50,6 @@ class BomMatchItemForm(MatchItemForm): return super().get_special_field(col_guess, row, file_manager) -class SetPartCategoryForm(forms.Form): - """Form for setting the category of multiple Part objects.""" - - part_category = TreeNodeChoiceField(queryset=PartCategory.objects.all(), required=True, help_text=_('Select part category')) - - class PartPriceForm(forms.Form): """Simple form for viewing part pricing information.""" diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 30c0867968..146b22abcc 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -165,7 +165,7 @@