From 6319beb14e493cc1075fdea298eb968954c8055c Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 28 Apr 2022 00:42:28 +0200 Subject: [PATCH] only print if models found --- .../0064_purchaseorderextraline_salesorderextraline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/InvenTree/order/migrations/0064_purchaseorderextraline_salesorderextraline.py b/InvenTree/order/migrations/0064_purchaseorderextraline_salesorderextraline.py index 78d64c8262..53bf0621ed 100644 --- a/InvenTree/order/migrations/0064_purchaseorderextraline_salesorderextraline.py +++ b/InvenTree/order/migrations/0064_purchaseorderextraline_salesorderextraline.py @@ -15,6 +15,8 @@ def _convert_model(apps, line_item_ref, extra_line_ref, price_ref): OrderExtraLine = apps.get_model('order', extra_line_ref) items_to_change = OrderLineItem.objects.filter(part=None) + if items_to_change.count() == 0: + return print(f'\nFound {items_to_change.count()} old {line_item_ref} instance(s)') print(f'Starting to convert - currently at {OrderExtraLine.objects.all().count()} {extra_line_ref} / {OrderLineItem.objects.all().count()} {line_item_ref} instance(s)')