Bug fix - ensure pk is set to None

This commit is contained in:
Oliver Walters 2019-09-01 23:28:28 +10:00
parent 7db938eda0
commit 906766cc0e

View File

@ -494,6 +494,7 @@ class StockItem(models.Model):
# Create a new StockItem object, duplicating relevant fields # Create a new StockItem object, duplicating relevant fields
# Nullify the PK so a new record is created # Nullify the PK so a new record is created
new_stock = StockItem.objects.get(pk=self.pk) new_stock = StockItem.objects.get(pk=self.pk)
new_stock.pk = None
new_stock.quantity = quantity new_stock.quantity = quantity
new_stock.save() new_stock.save()