mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Set allow_null flag on image fields
This commit is contained in:
		| @@ -53,7 +53,7 @@ class CompanySerializer(InvenTreeModelSerializer): | ||||
|  | ||||
|     url = serializers.CharField(source='get_absolute_url', read_only=True) | ||||
|  | ||||
|     image = InvenTreeImageSerializerField(required=False) | ||||
|     image = InvenTreeImageSerializerField(required=False, allow_null=True) | ||||
|  | ||||
|     parts_supplied = serializers.IntegerField(read_only=True) | ||||
|     parts_manufactured = serializers.IntegerField(read_only=True) | ||||
|   | ||||
| @@ -50,10 +50,15 @@ class CompanyTest(InvenTreeAPITestCase): | ||||
|         self.assertEqual(response.data['name'], 'ACME') | ||||
|  | ||||
|         # Change the name of the company | ||||
|         # Note we should not have the correct permissions (yet) | ||||
|         data = response.data | ||||
|         data['name'] = 'ACMOO' | ||||
|         response = self.client.patch(url, data, format='json') | ||||
|         self.assertEqual(response.status_code, status.HTTP_200_OK) | ||||
|         response = self.client.patch(url, data, format='json', expected_code=400) | ||||
|  | ||||
|         self.assignRole('company.change') | ||||
|  | ||||
|         response = self.client.patch(url, data, format='json', expected_code=200) | ||||
|  | ||||
|         self.assertEqual(response.data['name'], 'ACMOO') | ||||
|  | ||||
|     def test_company_search(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user