2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Add a default_location to the PartCategory model

- If a part does not specify a default location, look at the default location of  the category
This commit is contained in:
Oliver Walters
2019-05-04 19:00:11 +10:00
parent 59987940c8
commit 4ffaad3f1a
2 changed files with 27 additions and 0 deletions

View File

@ -30,6 +30,13 @@ class PartCategory(InvenTreeTree):
""" PartCategory provides hierarchical organization of Part objects.
"""
default_location = models.ForeignKey(
'stock.StockLocation', related_name="default_categories",
null=True, blank=True,
on_delete = models.SET_NULL,
help_text='Default location for parts in this category'
)
def get_absolute_url(self):
return reverse('category-detail', kwargs={'pk': self.id})