Prevent copying of labels and templates during data import phase

This commit is contained in:
Oliver Walters 2021-04-25 10:33:11 +10:00
parent 2d7bff0773
commit 6e5fc43105
2 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import os
import sys
import shutil
import logging
import hashlib
@ -32,8 +33,16 @@ class LabelConfig(AppConfig):
This function is called whenever the label app is loaded
"""
self.create_stock_item_labels()
self.create_stock_location_labels()
if 'loaddata' in sys.argv:
"""
In the case we are importing records,
do not automatically copy labels across.
This can cause database conflicts!
"""
pass
else:
self.create_stock_item_labels()
self.create_stock_location_labels()
def create_stock_item_labels(self):
"""

View File

@ -1,4 +1,5 @@
import os
import sys
import shutil
import logging
@ -17,8 +18,11 @@ class ReportConfig(AppConfig):
This function is called whenever the report app is loaded
"""
self.create_default_test_reports()
self.create_default_build_reports()
if 'loaddata' in sys.argv:
pass
else:
self.create_default_test_reports()
self.create_default_build_reports()
def create_default_reports(self, model, reports):
"""