2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 05:46:34 +00:00

Manager for importing StockLocation data

This commit is contained in:
Oliver Walters
2019-09-13 22:44:50 +10:00
parent 37ab3d214d
commit 23b814569a
2 changed files with 38 additions and 5 deletions

View File

@ -52,10 +52,10 @@ class PartCategoryResource(ModelResource):
parent = Field(attribute='parent', widget=widgets.ForeignKeyWidget(PartCategory))
default_location = Field(attribute='default_location', widget=widgets.ForeignKeyWidget(StockLocation))
parent_name = Field(attribute='parent__name', readonly=True)
default_location = Field(attribute='default_location', widget=widgets.ForeignKeyWidget(StockLocation))
class Meta:
model = PartCategory
skip_unchanged = True
@ -70,10 +70,8 @@ class PartCategoryResource(ModelResource):
super().after_import(dataset, result, using_transactions, dry_run, **kwargs)
print("Rebuilding PartCategory tree")
# Rebuild teh PartCategory tree
# Rebuild the PartCategory tree(s)
PartCategory.objects.rebuild()
print("Done!")
class PartCategoryAdmin(ImportExportModelAdmin):