From 7c1615a2b69c6239c9f3e1bbfd65047ee96b0af4 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 24 Sep 2019 07:59:59 +1000 Subject: [PATCH] Fix user recording when serializing stock --- InvenTree/stock/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index f2c31083c0..1cf1a870b8 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -130,6 +130,8 @@ class StockItem(models.Model): add_note = False user = kwargs.pop('user', None) + + add_note = add_note and kwargs.pop('note', True) super(StockItem, self).save(*args, **kwargs) @@ -468,7 +470,8 @@ class StockItem(models.Model): if location: new_item.location = location - new_item.save() + # The item already has a transaction history, don't create a new note + new_item.save(user=user, note=False) # Copy entire transaction history new_item.copyHistoryFrom(self)