From 52ca2e5068cdd7ce8f74d061d0beebac18ef58c9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 09:29:12 +1100 Subject: [PATCH] Add another check for merging stock --- InvenTree/script/translation_stats.py | 4 ++-- InvenTree/stock/models.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/InvenTree/script/translation_stats.py b/InvenTree/script/translation_stats.py index 2b0e8d639c..4ee83120eb 100644 --- a/InvenTree/script/translation_stats.py +++ b/InvenTree/script/translation_stats.py @@ -72,7 +72,7 @@ if __name__ == '__main__': if verbose: print(f"| {locale.ljust(4, ' ')} : {str(percentage).rjust(4, ' ')}% |") - + locales_perc[locale] = percentage percentages.append(percentage) @@ -89,4 +89,4 @@ if __name__ == '__main__': else: avg = 0 - print(f"InvenTree translation coverage: {avg}%") \ No newline at end of file + print(f"InvenTree translation coverage: {avg}%") diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 48db47ba0d..d302b1676c 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1166,6 +1166,9 @@ class StockItem(MPTTModel): if self.belongs_to: raise ValidationError(_('Stock item is installed in another item')) + if self.installed_item_count() > 0: + raise ValidationError(_('Stock item contains other items')) + if self.customer: raise ValidationError(_('Stock item has been assigned to a customer'))