mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-28 14:25:56 +00:00
Added owner field to both stock item and location tables and forms
This commit is contained in:
@@ -16,7 +16,7 @@ from django.db import models, transaction
|
||||
from django.db.models import Sum, Q
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
|
||||
@@ -44,6 +44,9 @@ class StockLocation(InvenTreeTree):
|
||||
Stock locations can be heirarchical as required
|
||||
"""
|
||||
|
||||
owner = models.ForeignKey(Group, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
related_name='owner_stocklocations')
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('stock-location-detail', kwargs={'pk': self.id})
|
||||
|
||||
@@ -459,6 +462,9 @@ class StockItem(MPTTModel):
|
||||
help_text=_('Single unit purchase price at time of purchase'),
|
||||
)
|
||||
|
||||
owner = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
related_name='owner_stockitems')
|
||||
|
||||
def clearAllocations(self):
|
||||
"""
|
||||
Clear all order allocations for this StockItem:
|
||||
|
Reference in New Issue
Block a user