Add 'default_keywords' field to a category

This commit is contained in:
Oliver Walters 2019-05-14 17:30:24 +10:00
parent 02033c2157
commit 0842bd5833
3 changed files with 28 additions and 1 deletions

View File

@ -119,7 +119,8 @@ class EditCategoryForm(HelperForm):
'parent',
'name',
'description',
'default_location'
'default_location',
'default_keywords',
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2 on 2019-05-14 07:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0023_part_keywords'),
]
operations = [
migrations.AddField(
model_name='partcategory',
name='default_keywords',
field=models.CharField(blank=True, help_text='Default keywords for parts in this category', max_length=250),
),
]

View File

@ -37,6 +37,12 @@ from company.models import Company
class PartCategory(InvenTreeTree):
""" PartCategory provides hierarchical organization of Part objects.
Attributes:
name: Name of this category
parent: Parent category
default_location: Default storage location for parts in this category or child categories
default_keywords: Default keywords for parts created in this category
"""
default_location = models.ForeignKey(
@ -46,6 +52,8 @@ class PartCategory(InvenTreeTree):
help_text='Default location for parts in this category'
)
default_keywords = models.CharField(blank=True, max_length=250, help_text='Default keywords for parts in this category')
def get_absolute_url(self):
return reverse('category-detail', kwargs={'pk': self.id})