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

Bug fix for ensuring location and category names are unique for common parent (#4361)

* Update Meta class for StockLocation and PartCategory

* Migration files

* Add extra unique requirements to  InvenTreeTree model

- unique_together does not work as expected with null values
This commit is contained in:
Oliver
2023-02-18 11:42:53 +11:00
committed by GitHub
parent cde2050236
commit 139274f356
4 changed files with 57 additions and 18 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 3.2.16 on 2023-02-17 21:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stock', '0092_alter_stockitem_updated'),
]
operations = [
migrations.AlterModelOptions(
name='stocklocation',
options={'verbose_name': 'Stock Location', 'verbose_name_plural': 'Stock Locations'},
),
]

View File

@ -47,6 +47,12 @@ class StockLocation(InvenTreeBarcodeMixin, MetadataMixin, InvenTreeTree):
Stock locations can be hierarchical as required
"""
class Meta:
"""Metaclass defines extra model properties"""
verbose_name = _('Stock Location')
verbose_name_plural = _('Stock Locations')
def delete_recursive(self, *args, **kwargs):
"""This function handles the recursive deletion of sub-locations depending on kwargs contents"""
delete_stock_items = kwargs.get('delete_stock_items', False)