mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-03 20:20:58 +00:00
Add custom migration
- Required to initialize the MPTT fields for the StockItem model
This commit is contained in:
21
InvenTree/stock/migrations/0022_auto_20200217_1109.py
Normal file
21
InvenTree/stock/migrations/0022_auto_20200217_1109.py
Normal file
@ -0,0 +1,21 @@
|
||||
# Generated by Django 2.2.9 on 2020-02-17 11:09
|
||||
|
||||
from django.db import migrations
|
||||
from stock import models
|
||||
|
||||
|
||||
def update_stock_item_tree(apps, schema_editor):
|
||||
# Update the StockItem MPTT model
|
||||
|
||||
models.StockItem.objects.rebuild()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0021_auto_20200215_2232'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_stock_item_tree)
|
||||
]
|
Reference in New Issue
Block a user