mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #896 from SchrodingersGat/company-ordering
Add default ordering for Company model
This commit is contained in:
commit
bb6b3b965d
17
InvenTree/company/migrations/0023_auto_20200808_0715.py
Normal file
17
InvenTree/company/migrations/0023_auto_20200808_0715.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.0.7 on 2020-08-08 07:15
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('company', '0022_auto_20200613_1045'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='company',
|
||||||
|
options={'ordering': ['name']},
|
||||||
|
),
|
||||||
|
]
|
@ -79,6 +79,9 @@ class Company(models.Model):
|
|||||||
is_manufacturer: boolean value, is this company a manufacturer
|
is_manufacturer: boolean value, is this company a manufacturer
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['name', ]
|
||||||
|
|
||||||
name = models.CharField(max_length=100, blank=False, unique=True,
|
name = models.CharField(max_length=100, blank=False, unique=True,
|
||||||
help_text=_('Company name'),
|
help_text=_('Company name'),
|
||||||
verbose_name=_('Company name'))
|
verbose_name=_('Company name'))
|
||||||
|
17
InvenTree/part/migrations/0047_auto_20200808_0715.py
Normal file
17
InvenTree/part/migrations/0047_auto_20200808_0715.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.0.7 on 2020-08-08 07:15
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0046_auto_20200804_0107'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='part',
|
||||||
|
options={'ordering': ['name'], 'verbose_name': 'Part', 'verbose_name_plural': 'Parts'},
|
||||||
|
),
|
||||||
|
]
|
@ -71,8 +71,8 @@ class PartCategory(InvenTreeTree):
|
|||||||
return reverse('category-detail', kwargs={'pk': self.id})
|
return reverse('category-detail', kwargs={'pk': self.id})
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Part Category"
|
verbose_name = _("Part Category")
|
||||||
verbose_name_plural = "Part Categories"
|
verbose_name_plural = _("Part Categories")
|
||||||
|
|
||||||
def get_parts(self, cascade=True):
|
def get_parts(self, cascade=True):
|
||||||
""" Return a queryset for all parts under this category.
|
""" Return a queryset for all parts under this category.
|
||||||
@ -239,6 +239,7 @@ class Part(MPTTModel):
|
|||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Part")
|
verbose_name = _("Part")
|
||||||
verbose_name_plural = _("Parts")
|
verbose_name_plural = _("Parts")
|
||||||
|
ordering = ['name', ]
|
||||||
|
|
||||||
class MPTTMeta:
|
class MPTTMeta:
|
||||||
# For legacy reasons the 'variant_of' field is used to indicate the MPTT parent
|
# For legacy reasons the 'variant_of' field is used to indicate the MPTT parent
|
||||||
@ -1490,7 +1491,7 @@ class BomItem(models.Model):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "BOM Item"
|
verbose_name = _("BOM Item")
|
||||||
|
|
||||||
# Prevent duplication of parent/child rows
|
# Prevent duplication of parent/child rows
|
||||||
unique_together = ('part', 'sub_part')
|
unique_together = ('part', 'sub_part')
|
||||||
|
Loading…
Reference in New Issue
Block a user