mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixes for unit testing
This commit is contained in:
parent
0020e85397
commit
a1203aa1e5
@ -207,7 +207,7 @@ class StockItem(MPTTModel):
|
||||
user,
|
||||
deltas=tracking_info,
|
||||
location=self.location,
|
||||
quantity=self.quantity,
|
||||
quantity=float(self.quantity),
|
||||
)
|
||||
|
||||
@property
|
||||
@ -977,7 +977,7 @@ class StockItem(MPTTModel):
|
||||
|
||||
Args:
|
||||
quantity: Number of items to serialize (integer)
|
||||
serials: List of serial numbers (list<int>)
|
||||
serials: List of serial numbers
|
||||
user: User object associated with action
|
||||
notes: Optional notes for tracking
|
||||
location: If specified, serialized items will be placed in the given location
|
||||
@ -1267,7 +1267,7 @@ class StockItem(MPTTModel):
|
||||
user,
|
||||
notes=notes,
|
||||
deltas={
|
||||
'quantity': self.quantity,
|
||||
'quantity': float(self.quantity),
|
||||
}
|
||||
)
|
||||
|
||||
@ -1300,8 +1300,8 @@ class StockItem(MPTTModel):
|
||||
user,
|
||||
notes=notes,
|
||||
deltas={
|
||||
'added': quantity,
|
||||
'quantity': self.quantity
|
||||
'added': float(quantity),
|
||||
'quantity': float(self.quantity),
|
||||
}
|
||||
)
|
||||
|
||||
@ -1332,8 +1332,8 @@ class StockItem(MPTTModel):
|
||||
user,
|
||||
notes=notes,
|
||||
deltas={
|
||||
'removed': quantity,
|
||||
'quantity': self.quantity,
|
||||
'removed': float(quantity),
|
||||
'quantity': float(self.quantity),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -5,6 +5,8 @@ from django.core.exceptions import ValidationError
|
||||
|
||||
import datetime
|
||||
|
||||
from InvenTree.status_codes import StockHistoryCode
|
||||
|
||||
from .models import StockLocation, StockItem, StockItemTracking
|
||||
from .models import StockItemTestResult
|
||||
|
||||
@ -217,7 +219,7 @@ class StockTest(TestCase):
|
||||
track = StockItemTracking.objects.filter(item=it).latest('id')
|
||||
|
||||
self.assertEqual(track.item, it)
|
||||
self.assertIn('Moved to', track.title)
|
||||
self.assertEqual(track.tracking_type, StockHistoryCode.STOCK_MOVE)
|
||||
self.assertEqual(track.notes, 'Moved to the bathroom')
|
||||
|
||||
def test_self_move(self):
|
||||
@ -284,8 +286,7 @@ class StockTest(TestCase):
|
||||
# Check that a tracking item was added
|
||||
track = StockItemTracking.objects.filter(item=it).latest('id')
|
||||
|
||||
self.assertIn('Counted', track.title)
|
||||
self.assertIn('items', track.title)
|
||||
self.assertEqual(track.tracking_type, StockHistoryCode.STOCK_COUNT)
|
||||
self.assertIn('Counted items', track.notes)
|
||||
|
||||
n = it.tracking_info.count()
|
||||
@ -304,7 +305,7 @@ class StockTest(TestCase):
|
||||
# Check that a tracking item was added
|
||||
track = StockItemTracking.objects.filter(item=it).latest('id')
|
||||
|
||||
self.assertIn('Added', track.title)
|
||||
self.assertEqual(track.tracking_type, StockHistoryCode.STOCK_ADD)
|
||||
self.assertIn('Added some items', track.notes)
|
||||
|
||||
self.assertFalse(it.add_stock(-10, None))
|
||||
@ -319,7 +320,7 @@ class StockTest(TestCase):
|
||||
# Check that a tracking item was added
|
||||
track = StockItemTracking.objects.filter(item=it).latest('id')
|
||||
|
||||
self.assertIn('Removed', track.title)
|
||||
self.assertEqual(track.tracking_type, StockHistoryCode.STOCK_REMOVE)
|
||||
self.assertIn('Removed some items', track.notes)
|
||||
self.assertTrue(it.has_tracking_info)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user