diff --git a/InvenTree/stock/admin.py b/InvenTree/stock/admin.py index 333c7d35c1..d3f0c31f8b 100644 --- a/InvenTree/stock/admin.py +++ b/InvenTree/stock/admin.py @@ -13,7 +13,7 @@ from .models import StockItemTracking from .models import StockItemTestResult from build.models import Build -from company.models import SupplierPart +from company.models import Company, SupplierPart from order.models import PurchaseOrder, SalesOrder from part.models import Part @@ -59,12 +59,14 @@ class StockItemResource(ModelResource): # Custom manaegrs for ForeignKey fields part = Field(attribute='part', widget=widgets.ForeignKeyWidget(Part)) - part_name = Field(attribute='part__full_ame', readonly=True) + part_name = Field(attribute='part__full_name', readonly=True) supplier_part = Field(attribute='supplier_part', widget=widgets.ForeignKeyWidget(SupplierPart)) supplier = Field(attribute='supplier_part__supplier__id', readonly=True) + customer = Field(attribute='customer', widget=widgets.ForeignKeyWidget(Company)) + supplier_name = Field(attribute='supplier_part__supplier__name', readonly=True) status_label = Field(attribute='status_label', readonly=True) @@ -77,6 +79,8 @@ class StockItemResource(ModelResource): build = Field(attribute='build', widget=widgets.ForeignKeyWidget(Build)) + parent = Field(attribute='parent', widget=widgets.ForeignKeyWidget(StockItem)) + sales_order = Field(attribute='sales_order', widget=widgets.ForeignKeyWidget(SalesOrder)) build_order = Field(attribute='build_order', widget=widgets.ForeignKeyWidget(Build)) @@ -101,6 +105,11 @@ class StockItemResource(ModelResource): report_skipped = False clean_model_instance = True + exclude = [ + # Exclude MPTT internal model fields + 'lft', 'rght', 'tree_id', 'level', + ] + class StockItemAdmin(ImportExportModelAdmin):