mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Add migration test (#4398)
* Add migration test Looking at older data migration which removes stock items which are "scheduled_for_deletion" * Account for parent / child relationships
This commit is contained in:
		@@ -22,7 +22,13 @@ def delete_scheduled(apps, schema_editor):
 | 
			
		||||
 | 
			
		||||
    if items.count() > 0:
 | 
			
		||||
        logger.info(f"Removing {items.count()} stock items scheduled for deletion")
 | 
			
		||||
        items.delete()
 | 
			
		||||
 | 
			
		||||
        # Ensure any parent / child relationships are updated!
 | 
			
		||||
        for item in items:
 | 
			
		||||
            childs = StockItem.objects.filter(parent=item)
 | 
			
		||||
            childs.update(parent=item.parent)
 | 
			
		||||
 | 
			
		||||
            item.delete()
 | 
			
		||||
 | 
			
		||||
    Task = apps.get_model('django_q', 'schedule')
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user