mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #924 from SchrodingersGat/stocktake-export-fixes
Stocktake export fixes
This commit is contained in:
commit
7a0e1e9574
@ -51,7 +51,8 @@ class PartResource(ModelResource):
|
||||
report_skipped = False
|
||||
clean_model_instances = True
|
||||
exclude = [
|
||||
'bom_checksum', 'bom_checked_by', 'bom_checked_date'
|
||||
'bom_checksum', 'bom_checked_by', 'bom_checked_date',
|
||||
'lft', 'rght', 'tree_id', 'level',
|
||||
]
|
||||
|
||||
def get_queryset(self):
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user