Fix user recording when serializing stock

This commit is contained in:
Oliver Walters 2019-09-24 07:59:59 +10:00
parent 41c07fc423
commit 7c1615a2b6

View File

@ -130,6 +130,8 @@ class StockItem(models.Model):
add_note = False add_note = False
user = kwargs.pop('user', None) user = kwargs.pop('user', None)
add_note = add_note and kwargs.pop('note', True)
super(StockItem, self).save(*args, **kwargs) super(StockItem, self).save(*args, **kwargs)
@ -468,7 +470,8 @@ class StockItem(models.Model):
if location: if location:
new_item.location = 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 # Copy entire transaction history
new_item.copyHistoryFrom(self) new_item.copyHistoryFrom(self)