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:
@ -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})
|
||||
|
||||
|
Reference in New Issue
Block a user