mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Override 'add_note' when new StockItem is created
- This allows us to prevent the issue of duplicate notes being created
This commit is contained in:
parent
0c19a94f5c
commit
84bfffd5a7
@ -366,7 +366,7 @@ class PurchaseOrder(Order):
|
||||
purchase_price=purchase_price,
|
||||
)
|
||||
|
||||
stock.save()
|
||||
stock.save(add_note=False)
|
||||
|
||||
tracking_info = {
|
||||
'status': status,
|
||||
|
@ -183,9 +183,12 @@ class StockItem(MPTTModel):
|
||||
self.validate_unique()
|
||||
self.clean()
|
||||
|
||||
# If 'add_note = False' specified, then no tracking note will be added for item creation
|
||||
add_note = kwargs.pop('add_note', True)
|
||||
|
||||
if not self.pk:
|
||||
# StockItem has not yet been saved
|
||||
add_note = True
|
||||
add_note = add_note and True
|
||||
else:
|
||||
# StockItem has already been saved
|
||||
add_note = False
|
||||
|
Loading…
Reference in New Issue
Block a user