mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 21:45:39 +00:00
Merge branch 'inventree:master' into matmair/issue2279
This commit is contained in:
@ -8,10 +8,9 @@ from import_export.resources import ModelResource
|
||||
from import_export.fields import Field
|
||||
import import_export.widgets as widgets
|
||||
|
||||
import part.models as models
|
||||
|
||||
from stock.models import StockLocation
|
||||
from company.models import SupplierPart
|
||||
import part.models as models
|
||||
from stock.models import StockLocation
|
||||
|
||||
|
||||
class PartResource(ModelResource):
|
||||
@ -76,6 +75,13 @@ class PartAdmin(ImportExportModelAdmin):
|
||||
|
||||
search_fields = ('name', 'description', 'category__name', 'category__description', 'IPN')
|
||||
|
||||
autocomplete_fields = [
|
||||
'variant_of',
|
||||
'category',
|
||||
'default_location',
|
||||
'default_supplier',
|
||||
]
|
||||
|
||||
|
||||
class PartCategoryResource(ModelResource):
|
||||
""" Class for managing PartCategory data import/export """
|
||||
@ -105,13 +111,6 @@ class PartCategoryResource(ModelResource):
|
||||
models.PartCategory.objects.rebuild()
|
||||
|
||||
|
||||
class PartCategoryInline(admin.TabularInline):
|
||||
"""
|
||||
Inline for PartCategory model
|
||||
"""
|
||||
model = models.PartCategory
|
||||
|
||||
|
||||
class PartCategoryAdmin(ImportExportModelAdmin):
|
||||
|
||||
resource_class = PartCategoryResource
|
||||
@ -120,35 +119,44 @@ class PartCategoryAdmin(ImportExportModelAdmin):
|
||||
|
||||
search_fields = ('name', 'description')
|
||||
|
||||
inlines = [
|
||||
PartCategoryInline,
|
||||
]
|
||||
autocomplete_fields = ('parent', 'default_location',)
|
||||
|
||||
|
||||
class PartRelatedAdmin(admin.ModelAdmin):
|
||||
''' Class to manage PartRelated objects '''
|
||||
pass
|
||||
"""
|
||||
Class to manage PartRelated objects
|
||||
"""
|
||||
|
||||
autocomplete_fields = ('part_1', 'part_2')
|
||||
|
||||
|
||||
class PartAttachmentAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('part', 'attachment', 'comment')
|
||||
|
||||
autocomplete_fields = ('part',)
|
||||
|
||||
|
||||
class PartStarAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('part', 'user')
|
||||
|
||||
autocomplete_fields = ('part',)
|
||||
|
||||
|
||||
class PartCategoryStarAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('category', 'user')
|
||||
|
||||
autocomplete_fields = ('category',)
|
||||
|
||||
|
||||
class PartTestTemplateAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('part', 'test_name', 'required')
|
||||
|
||||
autocomplete_fields = ('part',)
|
||||
|
||||
|
||||
class BomItemResource(ModelResource):
|
||||
""" Class for managing BomItem data import/export """
|
||||
@ -253,10 +261,14 @@ class BomItemAdmin(ImportExportModelAdmin):
|
||||
|
||||
search_fields = ('part__name', 'part__description', 'sub_part__name', 'sub_part__description')
|
||||
|
||||
autocomplete_fields = ('part', 'sub_part',)
|
||||
|
||||
|
||||
class ParameterTemplateAdmin(ImportExportModelAdmin):
|
||||
list_display = ('name', 'units')
|
||||
|
||||
search_fields = ('name', 'units')
|
||||
|
||||
|
||||
class ParameterResource(ModelResource):
|
||||
""" Class for managing PartParameter data import/export """
|
||||
@ -282,10 +294,12 @@ class ParameterAdmin(ImportExportModelAdmin):
|
||||
|
||||
list_display = ('part', 'template', 'data')
|
||||
|
||||
autocomplete_fields = ('part', 'template')
|
||||
|
||||
|
||||
class PartCategoryParameterAdmin(admin.ModelAdmin):
|
||||
|
||||
pass
|
||||
autocomplete_fields = ('category', 'parameter_template',)
|
||||
|
||||
|
||||
class PartSellPriceBreakAdmin(admin.ModelAdmin):
|
||||
@ -303,6 +317,8 @@ class PartInternalPriceBreakAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('part', 'quantity', 'price',)
|
||||
|
||||
autocomplete_fields = ('part',)
|
||||
|
||||
|
||||
admin.site.register(models.Part, PartAdmin)
|
||||
admin.site.register(models.PartCategory, PartCategoryAdmin)
|
||||
|
@ -583,6 +583,8 @@ class PartFilter(rest_filters.FilterSet):
|
||||
|
||||
active = rest_filters.BooleanFilter()
|
||||
|
||||
virtual = rest_filters.BooleanFilter()
|
||||
|
||||
|
||||
class PartList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
@ -69,6 +69,7 @@
|
||||
name: 'Widget'
|
||||
description: 'A watchamacallit'
|
||||
category: 7
|
||||
salable: true
|
||||
assembly: true
|
||||
trackable: true
|
||||
tree_id: 0
|
||||
@ -83,6 +84,7 @@
|
||||
name: 'Orphan'
|
||||
description: 'A part without a category'
|
||||
category: null
|
||||
salable: true
|
||||
tree_id: 0
|
||||
level: 0
|
||||
lft: 0
|
||||
@ -95,6 +97,7 @@
|
||||
name: 'Bob'
|
||||
description: 'Can we build it?'
|
||||
assembly: true
|
||||
salable: true
|
||||
purchaseable: false
|
||||
category: 7
|
||||
active: False
|
||||
@ -113,6 +116,7 @@
|
||||
description: 'A chair'
|
||||
is_template: True
|
||||
trackable: true
|
||||
salable: true
|
||||
category: 7
|
||||
tree_id: 1
|
||||
level: 0
|
||||
|
@ -73,7 +73,7 @@
|
||||
<div class='panel-content'>
|
||||
<div id='po-button-bar'>
|
||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||
{% include "filter_list.html" with id="purchaseorder" %}
|
||||
{% include "filter_list.html" with id="partpurchaseorders" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -703,12 +703,10 @@
|
||||
});
|
||||
|
||||
onPanelLoad("purchase-orders", function() {
|
||||
loadPurchaseOrderTable($("#purchase-order-table"), {
|
||||
url: "{% url 'api-po-list' %}",
|
||||
params: {
|
||||
part: {{ part.id }},
|
||||
},
|
||||
});
|
||||
loadPartPurchaseOrderTable(
|
||||
"#purchase-order-table",
|
||||
{{ part.pk }},
|
||||
);
|
||||
});
|
||||
|
||||
onPanelLoad("sales-orders", function() {
|
||||
|
Reference in New Issue
Block a user