2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 13:35:40 +00:00

Added help text for model fields

This commit is contained in:
Oliver Walters
2019-05-08 23:32:57 +10:00
parent a7794394a3
commit e9c904076f
9 changed files with 159 additions and 13 deletions

View File

@ -0,0 +1,35 @@
# Generated by Django 2.2 on 2019-05-08 13:32
from django.db import migrations, models
import django.db.models.deletion
import part.models
class Migration(migrations.Migration):
dependencies = [
('part', '0018_auto_20190505_2231'),
]
operations = [
migrations.AlterField(
model_name='part',
name='units',
field=models.CharField(blank=True, default='pcs', help_text='Stock keeping units for this part', max_length=20),
),
migrations.AlterField(
model_name='partattachment',
name='attachment',
field=models.FileField(blank=True, help_text='Select file to attach', null=True, upload_to=part.models.attach_file),
),
migrations.AlterField(
model_name='supplierpart',
name='part',
field=models.ForeignKey(help_text='Select part', limit_choices_to={'purchaseable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='supplier_parts', to='part.Part'),
),
migrations.AlterField(
model_name='supplierpart',
name='supplier',
field=models.ForeignKey(help_text='Select supplier', limit_choices_to={'is_supplier': True}, on_delete=django.db.models.deletion.CASCADE, related_name='parts', to='company.Company'),
),
]

View File

@ -193,7 +193,7 @@ class Part(models.Model):
minimum_stock = models.PositiveIntegerField(default=0, validators=[MinValueValidator(0)], help_text='Minimum allowed stock level')
# Units of quantity for this part. Default is "pcs"
units = models.CharField(max_length=20, default="pcs", blank=True)
units = models.CharField(max_length=20, default="pcs", blank=True, help_text='Stock keeping units for this part')
# Can this part be built from other parts?
buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?')
@ -438,7 +438,8 @@ class PartAttachment(models.Model):
part = models.ForeignKey(Part, on_delete=models.CASCADE,
related_name='attachments')
attachment = models.FileField(upload_to=attach_file, null=True, blank=True)
attachment = models.FileField(upload_to=attach_file, null=True, blank=True,
help_text='Select file to attach')
comment = models.CharField(max_length=100, blank=True, help_text='File comment')
@ -543,11 +544,13 @@ class SupplierPart(models.Model):
part = models.ForeignKey(Part, on_delete=models.CASCADE,
related_name='supplier_parts',
limit_choices_to={'purchaseable': True},
help_text='Select part',
)
supplier = models.ForeignKey(Company, on_delete=models.CASCADE,
related_name='parts',
limit_choices_to={'is_supplier': True}
limit_choices_to={'is_supplier': True},
help_text='Select supplier',
)
SKU = models.CharField(max_length=100, help_text='Supplier stock keeping unit')
@ -639,10 +642,15 @@ class SupplierPart(models.Model):
return cost + self.base_cost
def __str__(self):
return "{supplier} ({sku})".format(
s = "{supplier} ({sku})".format(
sku=self.SKU,
supplier=self.supplier.name)
if self.manufacturer_string:
s = s + ' - ' + self.manufacturer_string
return s
class SupplierPriceBreak(models.Model):
""" Represents a quantity price break for a SupplierPart