2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Exclude expired stock from builds

This commit is contained in:
Oliver Walters
2021-01-06 21:00:45 +11:00
parent 580e7599a0
commit 33d6396a4e
3 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,8 @@ from django.urls import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from common.models import InvenTreeSetting
import json
from datetime import datetime, timedelta
@ -32,6 +34,9 @@ class StockViewTestCase(TestCase):
password='password'
)
self.user.is_staff = True
self.user.save()
# Put the user into a group with the correct permissions
group = Group.objects.create(name='mygroup')
self.user.groups.add(group)
@ -163,6 +168,9 @@ class StockItemTest(StockViewTestCase):
and should be in the future!
"""
# First, ensure that the expiry date feature is enabled!
InvenTreeSetting.set_setting('STOCK_ENABLE_EXPIRY', True, self.user)
url = reverse('stock-item-create')
response = self.client.get(url, {'part': 25}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')