mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix behaviour on deleting parent stock item
This commit is contained in:
parent
552ca8e5c4
commit
fcb2bb2a46
20
InvenTree/stock/migrations/0073_alter_stockitem_parent.py
Normal file
20
InvenTree/stock/migrations/0073_alter_stockitem_parent.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.2.10 on 2021-12-20 13:54
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
import django.db.models.deletion
|
||||||
|
import mptt.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('stock', '0072_remove_stockitem_scheduled_for_deletion'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='stockitem',
|
||||||
|
name='parent',
|
||||||
|
field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='stock.stockitem', verbose_name='Parent Stock Item'),
|
||||||
|
),
|
||||||
|
]
|
@ -458,7 +458,7 @@ class StockItem(MPTTModel):
|
|||||||
parent = TreeForeignKey(
|
parent = TreeForeignKey(
|
||||||
'self',
|
'self',
|
||||||
verbose_name=_('Parent Stock Item'),
|
verbose_name=_('Parent Stock Item'),
|
||||||
on_delete=models.DO_NOTHING,
|
on_delete=models.SET_NULL,
|
||||||
blank=True, null=True,
|
blank=True, null=True,
|
||||||
related_name='children'
|
related_name='children'
|
||||||
)
|
)
|
||||||
@ -1252,6 +1252,7 @@ class StockItem(MPTTModel):
|
|||||||
self.add_tracking_entry(
|
self.add_tracking_entry(
|
||||||
StockHistoryCode.MERGED_STOCK_ITEMS,
|
StockHistoryCode.MERGED_STOCK_ITEMS,
|
||||||
user,
|
user,
|
||||||
|
quantity=self.quantity,
|
||||||
notes=notes,
|
notes=notes,
|
||||||
deltas={
|
deltas={
|
||||||
'location': location.pk,
|
'location': location.pk,
|
||||||
|
@ -867,7 +867,7 @@ function mergeStockItems(items, options={}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user