2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Save user who created a stock item

- Handled differently for batch or serialized parts
This commit is contained in:
Oliver Walters
2019-09-24 07:54:18 +10:00
parent 52ec213a28
commit 41c07fc423
3 changed files with 15 additions and 7 deletions

View File

@ -129,13 +129,15 @@ class StockItem(models.Model):
else:
add_note = False
user = kwargs.pop('user', None)
super(StockItem, self).save(*args, **kwargs)
if add_note:
# This StockItem is being saved for the first time
self.addTransactionNote(
'Created stock item',
None,
user,
notes="Created new stock item for part '{p}'".format(p=str(self.part)),
system=True
)