From fae44c30025226e6d98cf4abf52581219dc442e4 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 15 May 2019 09:21:31 +1000 Subject: [PATCH] Bug fix for part deep-copy - Don't copy an image if an image doesn't exist --- InvenTree/part/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 2d9b12e255..f4673dc309 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -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):