mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Add unit test to check an "empty" (null) barcode can be supplied
This commit is contained in:
		@@ -242,6 +242,7 @@ class POLineItemReceiveSerializer(serializers.Serializer):
 | 
				
			|||||||
        help_text=_('Unique identifier field'),
 | 
					        help_text=_('Unique identifier field'),
 | 
				
			||||||
        default='',
 | 
					        default='',
 | 
				
			||||||
        required=False,
 | 
					        required=False,
 | 
				
			||||||
 | 
					        allow_null=True,
 | 
				
			||||||
        allow_blank=True,
 | 
					        allow_blank=True,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -349,6 +349,31 @@ class PurchaseOrderReceiveTest(OrderTest):
 | 
				
			|||||||
        # No new stock items have been created
 | 
					        # No new stock items have been created
 | 
				
			||||||
        self.assertEqual(self.n, StockItem.objects.count())
 | 
					        self.assertEqual(self.n, StockItem.objects.count())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_null_barcode(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Test than a "null" barcode field can be provided
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Set stock item barcode
 | 
				
			||||||
 | 
					        item = StockItem.objects.get(pk=1)
 | 
				
			||||||
 | 
					        item.save()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Test with "null" value
 | 
				
			||||||
 | 
					        self.post(
 | 
				
			||||||
 | 
					            self.url,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                'items': [
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        'line_item': 1,
 | 
				
			||||||
 | 
					                        'quantity': 50,
 | 
				
			||||||
 | 
					                        'barcode': None,
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					                'location': 1,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            expected_code=201
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_invalid_barcodes(self):
 | 
					    def test_invalid_barcodes(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Tests for checking in items with invalid barcodes:
 | 
					        Tests for checking in items with invalid barcodes:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user