Bug fix for part deep-copy

- Don't copy an image if an image doesn't exist
This commit is contained in:
Oliver Walters 2019-05-15 09:21:31 +10:00
parent 292e29e95e
commit fae44c3002

View File

@ -574,10 +574,11 @@ class Part(models.Model):
# Copy the part image
if kwargs.get('image', True):
image_file = ContentFile(other.image.read())
image_file.name = rename_part_image(self, 'test.png')
if other.image:
image_file = ContentFile(other.image.read())
image_file.name = rename_part_image(self, 'test.png')
self.image = image_file
self.image = image_file
# Copy the BOM data
if kwargs.get('bom', False):