added missing translation fields #753

This commit is contained in:
Matthias 2021-04-03 03:59:09 +02:00
parent 698b946403
commit 2de6fcbfa4
8 changed files with 36 additions and 25 deletions

View File

@ -56,19 +56,20 @@ class InvenTreeAttachment(models.Model):
def __str__(self): def __str__(self):
return os.path.basename(self.attachment.name) return os.path.basename(self.attachment.name)
attachment = models.FileField(upload_to=rename_attachment, attachment = models.FileField(upload_to=rename_attachment, verbose_name=_('Attachment'),
help_text=_('Select file to attach')) help_text=_('Select file to attach'))
comment = models.CharField(blank=True, max_length=100, help_text=_('File comment')) comment = models.CharField(blank=True, max_length=100, verbose_name=_('Comment'), help_text=_('File comment'))
user = models.ForeignKey( user = models.ForeignKey(
User, User,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, null=True, blank=True, null=True,
verbose_name=_('User'),
help_text=_('User'), help_text=_('User'),
) )
upload_date = models.DateField(auto_now_add=True, null=True, blank=True) upload_date = models.DateField(auto_now_add=True, null=True, blank=True, verbose_name=_('upload date'))
@property @property
def basename(self): def basename(self):
@ -103,12 +104,14 @@ class InvenTreeTree(MPTTModel):
blank=False, blank=False,
max_length=100, max_length=100,
validators=[validate_tree_name], validators=[validate_tree_name],
verbose_name=_("Name"),
help_text=_("Name"), help_text=_("Name"),
) )
description = models.CharField( description = models.CharField(
blank=True, blank=True,
max_length=250, max_length=250,
verbose_name=_("Description"),
help_text=_("Description (optional)") help_text=_("Description (optional)")
) )
@ -117,6 +120,7 @@ class InvenTreeTree(MPTTModel):
on_delete=models.DO_NOTHING, on_delete=models.DO_NOTHING,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("parent"),
related_name='children') related_name='children')
@property @property

View File

@ -36,11 +36,13 @@ class EditBuildForm(HelperForm):
} }
target_date = DatePickerFormField( target_date = DatePickerFormField(
label=_('Target Date'),
help_text=_('Target date for build completion. Build will be overdue after this date.') help_text=_('Target date for build completion. Build will be overdue after this date.')
) )
quantity = RoundingDecimalFormField( quantity = RoundingDecimalFormField(
max_digits=10, decimal_places=5, max_digits=10, decimal_places=5,
label=_('Quantity'),
help_text=_('Number of items to build') help_text=_('Number of items to build')
) )
@ -87,7 +89,7 @@ class BuildOutputCreateForm(HelperForm):
) )
serial_numbers = forms.CharField( serial_numbers = forms.CharField(
label=_('Serial numbers'), label=_('Serial Numbers'),
required=False, required=False,
help_text=_('Enter serial numbers for build outputs'), help_text=_('Enter serial numbers for build outputs'),
) )

View File

@ -224,12 +224,13 @@ class Build(MPTTModel):
help_text=_('Target date for build completion. Build will be overdue after this date.') help_text=_('Target date for build completion. Build will be overdue after this date.')
) )
completion_date = models.DateField(null=True, blank=True) completion_date = models.DateField(null=True, blank=True, verbose_name=_('Completion Date'))
completed_by = models.ForeignKey( completed_by = models.ForeignKey(
User, User,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, null=True, blank=True, null=True,
verbose_name=_('completed by'),
related_name='builds_completed' related_name='builds_completed'
) )
@ -237,6 +238,7 @@ class Build(MPTTModel):
User, User,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, null=True, blank=True, null=True,
verbose_name=_('Issued by'),
help_text=_('User who issued this build order'), help_text=_('User who issued this build order'),
related_name='builds_issued', related_name='builds_issued',
) )
@ -245,6 +247,7 @@ class Build(MPTTModel):
UserModels.Owner, UserModels.Owner,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, null=True, blank=True, null=True,
verbose_name=_('Responsible'),
help_text=_('User responsible for this build order'), help_text=_('User responsible for this build order'),
related_name='builds_responsible', related_name='builds_responsible',
) )

View File

@ -34,6 +34,7 @@ class EditCompanyForm(HelperForm):
currency = django.forms.ChoiceField( currency = django.forms.ChoiceField(
required=False, required=False,
label=_('Currency'),
help_text=_('Default currency used for this company'), help_text=_('Default currency used for this company'),
choices=[('', '----------')] + djmoney.settings.CURRENCY_CHOICES, choices=[('', '----------')] + djmoney.settings.CURRENCY_CHOICES,
initial=common.settings.currency_code_default, initial=common.settings.currency_code_default,

View File

@ -126,11 +126,11 @@ class Company(models.Model):
notes = MarkdownxField(blank=True) notes = MarkdownxField(blank=True)
is_customer = models.BooleanField(default=False, help_text=_('Do you sell items to this company?')) is_customer = models.BooleanField(default=False, verbose_name=_('is customer'), help_text=_('Do you sell items to this company?'))
is_supplier = models.BooleanField(default=True, help_text=_('Do you purchase items from this company?')) is_supplier = models.BooleanField(default=True, verbose_name=_('is supplier'), help_text=_('Do you purchase items from this company?'))
is_manufacturer = models.BooleanField(default=False, help_text=_('Does this company manufacture parts?')) is_manufacturer = models.BooleanField(default=False, verbose_name=_('is manufacturer'), help_text=_('Does this company manufacture parts?'))
currency = models.CharField( currency = models.CharField(
max_length=3, max_length=3,
@ -366,11 +366,11 @@ class SupplierPart(models.Model):
help_text=_('Notes') help_text=_('Notes')
) )
base_cost = models.DecimalField(max_digits=10, decimal_places=3, default=0, validators=[MinValueValidator(0)], help_text=_('Minimum charge (e.g. stocking fee)')) base_cost = models.DecimalField(max_digits=10, decimal_places=3, default=0, validators=[MinValueValidator(0)], verbose_name=('base cost'), help_text=_('Minimum charge (e.g. stocking fee)'))
packaging = models.CharField(max_length=50, blank=True, null=True, help_text=_('Part packaging')) packaging = models.CharField(max_length=50, blank=True, null=True, verbose_name=_('Packaging'), help_text=_('Part packaging'))
multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text=('Order multiple')) multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], verbose_name=_('multiple'), help_text=('Order multiple'))
# TODO - Reimplement lead-time as a charfield with special validation (pattern matching). # TODO - Reimplement lead-time as a charfield with special validation (pattern matching).
# lead_time = models.DurationField(blank=True, null=True) # lead_time = models.DurationField(blank=True, null=True)

View File

@ -69,10 +69,11 @@ class PartCategory(InvenTreeTree):
'stock.StockLocation', related_name="default_categories", 'stock.StockLocation', related_name="default_categories",
null=True, blank=True, null=True, blank=True,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
verbose_name=_('Default Location'),
help_text=_('Default location for parts in this category') help_text=_('Default location for parts in this category')
) )
default_keywords = models.CharField(null=True, blank=True, max_length=250, help_text=_('Default keywords for parts in this category')) default_keywords = models.CharField(null=True, blank=True, max_length=250, verbose_name=_('Default keywords'), help_text=_('Default keywords for parts in this category'))
def get_absolute_url(self): def get_absolute_url(self):
return reverse('category-detail', kwargs={'pk': self.id}) return reverse('category-detail', kwargs={'pk': self.id})
@ -870,18 +871,18 @@ class Part(MPTTModel):
help_text=_('Part notes - supports Markdown formatting') help_text=_('Part notes - supports Markdown formatting')
) )
bom_checksum = models.CharField(max_length=128, blank=True, help_text=_('Stored BOM checksum')) bom_checksum = models.CharField(max_length=128, blank=True, verbose_name=_('BOM checksum'), help_text=_('Stored BOM checksum'))
bom_checked_by = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, bom_checked_by = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True,
related_name='boms_checked') verbose_name=_('BOM checked by'), related_name='boms_checked')
bom_checked_date = models.DateField(blank=True, null=True) bom_checked_date = models.DateField(blank=True, null=True, verbose_name=_('BOM checked date'))
creation_date = models.DateField(auto_now_add=True, editable=False, blank=True, null=True) creation_date = models.DateField(auto_now_add=True, editable=False, blank=True, null=True, verbose_name=_('Creation Date'))
creation_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, related_name='parts_created') creation_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_('Creation User'), related_name='parts_created')
responsible = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, related_name='parts_responible') responsible = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_('Responsible'), related_name='parts_responible')
def format_barcode(self, **kwargs): def format_barcode(self, **kwargs):
""" Return a JSON string for formatting a barcode for this Part object """ """ Return a JSON string for formatting a barcode for this Part object """
@ -2050,11 +2051,11 @@ class PartParameter(models.Model):
# Prevent multiple instances of a parameter for a single part # Prevent multiple instances of a parameter for a single part
unique_together = ('part', 'template') unique_together = ('part', 'template')
part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='parameters', help_text=_('Parent Part')) part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='parameters', verbose_name=_('Part'), help_text=_('Parent Part'))
template = models.ForeignKey(PartParameterTemplate, on_delete=models.CASCADE, related_name='instances', help_text=_('Parameter Template')) template = models.ForeignKey(PartParameterTemplate, on_delete=models.CASCADE, related_name='instances', verbose_name=_('Template'), help_text=_('Parameter Template'))
data = models.CharField(max_length=500, help_text=_('Parameter Value')) data = models.CharField(max_length=500, verbose_name=_('Data'), help_text=_('Parameter Value'))
@classmethod @classmethod
def create(cls, part, template, data, save=False): def create(cls, part, template, data, save=False):

View File

@ -114,7 +114,7 @@ class CreateStockItemForm(HelperForm):
help_text=('Expiration date for this stock item'), help_text=('Expiration date for this stock item'),
) )
serial_numbers = forms.CharField(label=_('Serial numbers'), required=False, help_text=_('Enter unique serial numbers (or leave blank)')) serial_numbers = forms.CharField(label=_('Serial Numbers'), required=False, help_text=_('Enter unique serial numbers (or leave blank)'))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -1548,11 +1548,11 @@ class StockItemTracking(models.Model):
date = models.DateTimeField(auto_now_add=True, editable=False) date = models.DateTimeField(auto_now_add=True, editable=False)
title = models.CharField(blank=False, max_length=250, help_text=_('Tracking entry title')) title = models.CharField(blank=False, max_length=250, verbose_name=_('Title'), help_text=_('Tracking entry title'))
notes = models.CharField(blank=True, max_length=512, help_text=_('Entry notes')) notes = models.CharField(blank=True, max_length=512, verbose_name=_('Notes'), help_text=_('Entry notes'))
link = InvenTreeURLField(blank=True, help_text=_('Link to external page for further information')) link = InvenTreeURLField(blank=True, verbose_name=_('Link'), help_text=_('Link to external page for further information'))
user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True) user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)