2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-18 08:31:33 +00:00

Allow barcodes to be added to incoming items via web UI (#4574)

* Fixes for receiving a line item with a barcode

- Record the raw barcode data in addition to the hash

* Improvements to 'receive purchase order items' dialog

* Add code for assigning barcodes to incoming order items

* Unit test fixes
This commit is contained in:
Oliver
2023-04-04 11:42:49 +10:00
committed by GitHub
parent 7af2bb4e8c
commit 1088b9c947
8 changed files with 181 additions and 79 deletions

View File

@@ -837,8 +837,7 @@ class PurchaseOrderReceiveTest(OrderTest):
"""
# Set stock item barcode
item = StockItem.objects.get(pk=1)
item.barcode_hash = 'MY-BARCODE-HASH'
item.save()
item.assign_barcode(barcode_data='MY-BARCODE-HASH')
response = self.post(
self.url,
@@ -956,8 +955,8 @@ class PurchaseOrderReceiveTest(OrderTest):
self.assertEqual(stock_2.last().location.pk, 2)
# Barcodes should have been assigned to the stock items
self.assertTrue(StockItem.objects.filter(barcode_hash='MY-UNIQUE-BARCODE-123').exists())
self.assertTrue(StockItem.objects.filter(barcode_hash='MY-UNIQUE-BARCODE-456').exists())
self.assertTrue(StockItem.objects.filter(barcode_data='MY-UNIQUE-BARCODE-123').exists())
self.assertTrue(StockItem.objects.filter(barcode_data='MY-UNIQUE-BARCODE-456').exists())
def test_batch_code(self):
"""Test that we can supply a 'batch code' when receiving items."""