mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10:54 +00:00
added more translation-strings
This commit is contained in:
@ -195,7 +195,7 @@ class StockCount(StockAdjust):
|
||||
if item['item'].stocktake(item['quantity'], request.user, notes=self.notes):
|
||||
n += 1
|
||||
|
||||
return Response({'success': 'Updated stock for {n} items'.format(n=n)})
|
||||
return Response({'success': _('Updated stock for {n} items').format(n=n)})
|
||||
|
||||
|
||||
class StockAdd(StockAdjust):
|
||||
@ -264,7 +264,7 @@ class StockTransfer(StockAdjust):
|
||||
if item['item'].move(location, self.notes, request.user, quantity=item['quantity']):
|
||||
n += 1
|
||||
|
||||
return Response({'success': 'Moved {n} parts to {loc}'.format(
|
||||
return Response({'success': _('Moved {n} parts to {loc}').format(
|
||||
n=n,
|
||||
loc=str(location),
|
||||
)})
|
||||
|
@ -111,7 +111,8 @@ class CreateStockItemForm(HelperForm):
|
||||
""" Form for creating a new StockItem """
|
||||
|
||||
expiry_date = DatePickerFormField(
|
||||
help_text=('Expiration date for this stock item'),
|
||||
label=_('Expiry Date'),
|
||||
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)'))
|
||||
@ -165,13 +166,13 @@ class CreateStockItemForm(HelperForm):
|
||||
class SerializeStockForm(HelperForm):
|
||||
""" Form for serializing a StockItem. """
|
||||
|
||||
destination = TreeNodeChoiceField(queryset=StockLocation.objects.all(), label='Destination', required=True, help_text='Destination for serialized stock (by default, will remain in current location)')
|
||||
destination = TreeNodeChoiceField(queryset=StockLocation.objects.all(), label=_('Destination'), required=True, help_text=_('Destination for serialized stock (by default, will remain in current location)'))
|
||||
|
||||
serial_numbers = forms.CharField(label='Serial numbers', required=True, help_text='Unique serial numbers (must match quantity)')
|
||||
serial_numbers = forms.CharField(label=_('Serial numbers'), required=True, help_text=_('Unique serial numbers (must match quantity)'))
|
||||
|
||||
note = forms.CharField(label='Notes', required=False, help_text='Add transaction note (optional)')
|
||||
note = forms.CharField(label=_('Notes'), required=False, help_text=_('Add transaction note (optional)'))
|
||||
|
||||
quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5)
|
||||
quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5, label=_('Quantity'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@ -263,7 +264,7 @@ class ExportOptionsForm(HelperForm):
|
||||
|
||||
file_format = forms.ChoiceField(label=_('File Format'), help_text=_('Select output file format'))
|
||||
|
||||
include_sublocations = forms.BooleanField(required=False, initial=True, help_text=_("Include stock items in sub locations"))
|
||||
include_sublocations = forms.BooleanField(required=False, initial=True, label=_('Include sublocations'), help_text=_("Include stock items in sub locations"))
|
||||
|
||||
class Meta:
|
||||
model = StockLocation
|
||||
@ -402,7 +403,8 @@ class EditStockItemForm(HelperForm):
|
||||
"""
|
||||
|
||||
expiry_date = DatePickerFormField(
|
||||
help_text=('Expiration date for this stock item'),
|
||||
label=_('Expiry Date'),
|
||||
help_text=_('Expiration date for this stock item'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@ -1,9 +1,10 @@
|
||||
# Generated by Django 3.0.7 on 2021-04-03 12:10
|
||||
# Generated by Django 3.0.7 on 2021-04-04 20:16
|
||||
|
||||
import InvenTree.fields
|
||||
import InvenTree.models
|
||||
import InvenTree.validators
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import mptt.fields
|
||||
@ -12,11 +13,22 @@ import mptt.fields
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0005_owner_model'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('stock', '0058_stockitem_packaging'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='stockitem',
|
||||
name='delete_on_deplete',
|
||||
field=models.BooleanField(default=True, help_text='Delete this Stock Item when stock is depleted', verbose_name='Delete on deplete'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stockitem',
|
||||
name='owner',
|
||||
field=models.ForeignKey(blank=True, help_text='Select Owner', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stock_items', to='users.Owner', verbose_name='Owner'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stockitemattachment',
|
||||
name='attachment',
|
||||
@ -47,6 +59,11 @@ class Migration(migrations.Migration):
|
||||
name='notes',
|
||||
field=models.CharField(blank=True, help_text='Entry notes', max_length=512, verbose_name='Notes'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stockitemtracking',
|
||||
name='quantity',
|
||||
field=models.DecimalField(decimal_places=5, default=1, max_digits=15, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Quantity'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stockitemtracking',
|
||||
name='title',
|
||||
@ -62,6 +79,11 @@ class Migration(migrations.Migration):
|
||||
name='name',
|
||||
field=models.CharField(help_text='Name', max_length=100, validators=[InvenTree.validators.validate_tree_name], verbose_name='Name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stocklocation',
|
||||
name='owner',
|
||||
field=models.ForeignKey(blank=True, help_text='Select Owner', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stock_locations', to='users.Owner', verbose_name='Owner'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stocklocation',
|
||||
name='parent',
|
@ -51,7 +51,8 @@ class StockLocation(InvenTreeTree):
|
||||
"""
|
||||
|
||||
owner = models.ForeignKey(Owner, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
help_text='Select Owner',
|
||||
verbose_name=_('Owner'),
|
||||
help_text=_('Select Owner'),
|
||||
related_name='stock_locations')
|
||||
|
||||
def get_absolute_url(self):
|
||||
@ -483,7 +484,7 @@ class StockItem(MPTTModel):
|
||||
|
||||
review_needed = models.BooleanField(default=False)
|
||||
|
||||
delete_on_deplete = models.BooleanField(default=True, help_text=_('Delete this Stock Item when stock is depleted'))
|
||||
delete_on_deplete = models.BooleanField(default=True, verbose_name=_('Delete on deplete'), help_text=_('Delete this Stock Item when stock is depleted'))
|
||||
|
||||
status = models.PositiveIntegerField(
|
||||
default=StockStatus.OK,
|
||||
@ -507,7 +508,8 @@ class StockItem(MPTTModel):
|
||||
)
|
||||
|
||||
owner = models.ForeignKey(Owner, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
help_text='Select Owner',
|
||||
verbose_name=_('Owner'),
|
||||
help_text=_('Select Owner'),
|
||||
related_name='stock_items')
|
||||
|
||||
def is_stale(self):
|
||||
@ -948,7 +950,7 @@ class StockItem(MPTTModel):
|
||||
raise ValidationError({"quantity": _("Quantity must be greater than zero")})
|
||||
|
||||
if quantity > self.quantity:
|
||||
raise ValidationError({"quantity": _("Quantity must not exceed available stock quantity ({n})".format(n=self.quantity))})
|
||||
raise ValidationError({"quantity": _("Quantity must not exceed available stock quantity ({n})").format(n=self.quantity)})
|
||||
|
||||
if not type(serials) in [list, tuple]:
|
||||
raise ValidationError({"serial_numbers": _("Serial numbers must be a list of integers")})
|
||||
@ -989,7 +991,7 @@ class StockItem(MPTTModel):
|
||||
new_item.addTransactionNote(_('Add serial number'), user, notes=notes)
|
||||
|
||||
# Remove the equivalent number of items
|
||||
self.take_stock(quantity, user, notes=_('Serialized {n} items'.format(n=quantity)))
|
||||
self.take_stock(quantity, user, notes=_('Serialized {n} items').format(n=quantity))
|
||||
|
||||
@transaction.atomic
|
||||
def copyHistoryFrom(self, other):
|
||||
@ -1558,7 +1560,7 @@ class StockItemTracking(models.Model):
|
||||
|
||||
system = models.BooleanField(default=False)
|
||||
|
||||
quantity = models.DecimalField(max_digits=15, decimal_places=5, validators=[MinValueValidator(0)], default=1)
|
||||
quantity = models.DecimalField(max_digits=15, decimal_places=5, validators=[MinValueValidator(0)], default=1, verbose_name=_('Quantity'))
|
||||
|
||||
# TODO
|
||||
# image = models.ImageField(upload_to=func, max_length=255, null=True, blank=True)
|
||||
|
@ -965,7 +965,7 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
|
||||
context['stock_action'] = self.stock_action.strip().lower()
|
||||
|
||||
context['stock_action_title'] = self.stock_action.capitalize()
|
||||
context['stock_action_title'] = self.stock_action_title
|
||||
|
||||
# Quantity column will be read-only in some circumstances
|
||||
context['edit_quantity'] = not self.stock_action == 'delete'
|
||||
@ -993,17 +993,18 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
if self.stock_action not in ['move', 'count', 'take', 'add', 'delete']:
|
||||
self.stock_action = 'count'
|
||||
|
||||
# Choose the form title based on the action
|
||||
# Choose form title and action column based on the action
|
||||
titles = {
|
||||
'move': _('Move Stock Items'),
|
||||
'count': _('Count Stock Items'),
|
||||
'take': _('Remove From Stock'),
|
||||
'add': _('Add Stock Items'),
|
||||
'delete': _('Delete Stock Items')
|
||||
'move': [_('Move Stock Items'), _('Move')],
|
||||
'count': [_('Count Stock Items'), _('Count')],
|
||||
'take': [_('Remove From Stock'), _('Take')],
|
||||
'add': [_('Add Stock Items'), _('Add')],
|
||||
'delete': [_('Delete Stock Items'), _('Delete')],
|
||||
}
|
||||
|
||||
self.ajax_form_title = titles[self.stock_action]
|
||||
|
||||
self.ajax_form_title = titles[self.stock_action][0]
|
||||
self.stock_action_title = titles[self.stock_action][1]
|
||||
|
||||
# Save list of items!
|
||||
self.stock_items = self.get_GET_items()
|
||||
|
||||
@ -1039,7 +1040,7 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
if self.stock_action in ['move', 'take']:
|
||||
|
||||
if item.new_quantity > item.quantity:
|
||||
item.error = _('Quantity must not exceed {x}'.format(x=item.quantity))
|
||||
item.error = _('Quantity must not exceed {x}').format(x=item.quantity)
|
||||
valid = False
|
||||
continue
|
||||
|
||||
@ -1118,7 +1119,7 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
|
||||
count += 1
|
||||
|
||||
return f"{_('Added stock to ')} {count} {_('items')}"
|
||||
return _('Added stock to {n} items').format(n=count)
|
||||
|
||||
def do_take(self):
|
||||
|
||||
@ -1133,7 +1134,7 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
|
||||
count += 1
|
||||
|
||||
return f"{_('Removed stock from ')} {count} {_('items')}"
|
||||
return _('Removed stock from {n} items').format(n=count)
|
||||
|
||||
def do_count(self):
|
||||
|
||||
@ -1189,9 +1190,9 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
return _('No items were moved')
|
||||
|
||||
else:
|
||||
return _('Moved {n} items to {dest}'.format(
|
||||
return _('Moved {n} items to {dest}').format(
|
||||
n=count,
|
||||
dest=destination.pathstring))
|
||||
dest=destination.pathstring)
|
||||
|
||||
def do_delete(self):
|
||||
""" Delete multiple stock items """
|
||||
@ -1208,7 +1209,7 @@ class StockAdjust(AjaxView, FormMixin):
|
||||
|
||||
count += 1
|
||||
|
||||
return _("Deleted {n} stock items".format(n=count))
|
||||
return _("Deleted {n} stock items").format(n=count)
|
||||
|
||||
|
||||
class StockItemEdit(AjaxUpdateView):
|
||||
|
Reference in New Issue
Block a user