Translations update

This commit is contained in:
guillaume-renaud 2017-01-08 11:46:25 +01:00
parent 539faccab2
commit 6f88d0cf8c
7 changed files with 1159 additions and 500 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -27,10 +27,10 @@ class StockItem(models.Model):
The StockItem class, element of the stock
"""
name = models.CharField(_('name'), max_length=64)
unit_quantity = models.IntegerField(_('unit quantity'), default=0, help_text='number of element in one box')
effective_quantity = models.IntegerField(_('effective quantity'), default=0, help_text='number of box')
unit_quantity = models.IntegerField(_('unit quantity'), default=0, help_text=_('number of element in one box'))
effective_quantity = models.IntegerField(_('effective quantity'), default=0, help_text=_('number of box'))
minimal_quantity = models.IntegerField(_('minimal quantity'), default=1,
help_text='if the effective quantity is less than the minimal, item is added to the shopping list')
help_text=_('if the effective quantity is less than the minimal, item is added to the shopping list'))
type = models.ForeignKey(ProductType, related_name="stock_items", verbose_name=_("type"), null=True, blank=True,
on_delete=models.SET_NULL)
stock_owner = models.ForeignKey(Stock, related_name="items")
@ -67,13 +67,13 @@ class ShoppingList(models.Model):
class ShoppingListItem(models.Model):
"""
"""
shopping_lists = models.ManyToManyField(ShoppingList, verbose_name=_('shopping lists'), related_name="shopping_items_to_buy")
shopping_lists = models.ManyToManyField(ShoppingList, verbose_name=_("shopping lists"), related_name="shopping_items_to_buy")
stockitem_owner = models.ForeignKey(StockItem, related_name="shopping_item", null=True)
name = models.CharField(_('name'), max_length=64)
type = models.ForeignKey(ProductType, related_name="shoppinglist_items", verbose_name=_("type"), null=True, blank=True,
on_delete=models.SET_NULL)
tobuy_quantity = models.IntegerField(_('quantity to buy'), default=6, help_text="quantity to buy during the next shopping session")
bought_quantity = models.IntegerField(_('quantity bought'), default=0, help_text="quantity bought during the last shopping session")
tobuy_quantity = models.IntegerField(_('quantity to buy'), default=6, help_text=_("quantity to buy during the next shopping session"))
bought_quantity = models.IntegerField(_('quantity bought'), default=0, help_text=_("quantity bought during the last shopping session"))
def __str__(self):
return "%s - %s" % (self.name, self.shopping_lists.first())

View File

@ -34,7 +34,7 @@
</table>
{% endif %}
{% endfor %}
<h4>Other</h4>
<h4>{% trans %}Other{% endtrans %}</h4>
<br>
<table>
<thead>

View File

@ -15,7 +15,7 @@ Shopping list for {{ stock }}
<br>
{% trans %}Use the "update stock" action when you get back from shopping to add the effective quantity bought for each shopping list item.{% endtrans %}
<br>
{% trans %}For example, 3 Cheesburger (boxes) are aksing in the list, but there were only 2 so, 2 have to be added in the stock quantity.{% endtrans %}
{% trans %}For example, 3 Cheeseburger (boxes) are aksing in the list, but there were only 2 so, 2 have to be added in the stock quantity.{% endtrans %}
</p>
<h4>{% trans %}To do{% endtrans %}</h4>

View File

@ -2,11 +2,11 @@
{% from 'core/macros.jinja' import user_profile_link %}
{% block title %}
{% trans s = stock %}Take items form {{ s }}{% endtrans %}
{% trans s = stock %}Take items from {{ s }}{% endtrans %}
{% endblock %}
{% block content %}
<h3>{% trans s = stock %}Take items form {{ s }}{% endtrans %}</h3>
<h3>{% trans s = stock %}Take items from {{ s }}{% endtrans %}</h3>
<div>
<form method="post" action="" class="inline" style="display:inline">
{% csrf_token %}

View File

@ -178,15 +178,15 @@ class StockItemQuantityBaseFormView(CounterAdminTabsMixin, CanEditMixin, DetailV
def get_form_class(self):
fields = OrderedDict()
kwargs = {}
fields['name'] = forms.CharField(max_length=30, required=True, label='Shopping list name')
fields['name'] = forms.CharField(max_length=30, required=True, label=_('Shopping list name'))
for t in ProductType.objects.order_by('name').all():
for i in self.stock.items.filter(type=t).order_by('name').all():
if i.effective_quantity <= i.minimal_quantity:
field_name = "item-%s" % (str(i.id))
fields[field_name] = forms.IntegerField(required=True, label=str(i),
help_text=str(i.effective_quantity)+" left")
fields['comment'] = forms.CharField(widget=forms.Textarea(), required=False,
initial="Add here, items to buy that are not reference as a product (example : sponge, knife, mugs ...)")
help_text=_(str(i.effective_quantity)+" left"))
fields['comment'] = forms.CharField(widget=forms.Textarea(), required=False, label=_("Comments"),
initial=_("Add here, items to buy that are not reference as a stock item (example : sponge, knife, mugs ...)"))
kwargs['stock_id'] = self.stock.id
kwargs['base_fields'] = fields
return type('StockItemQuantityForm', (StockItemQuantityForm,), kwargs)
@ -288,17 +288,12 @@ class StockUpdateAfterShopppingForm(forms.BaseForm):
self.shoppinglist = ShoppingList.objects.filter(id=self.shoppinglist_id).first()
for k,t in self.cleaned_data.items():
shoppinglist_item_id = int(k[5:])
#item_id = int(k[5:])
if int(t) > 0 :
shoppinglist_item = ShoppingListItem.objects.filter(id=shoppinglist_item_id).first()
shoppinglist_item.bought_quantity = int(t)
shoppinglist_item.save()
shoppinglist_item.stockitem_owner.effective_quantity += int(t)
shoppinglist_item.stockitem_owner.save()
#item = StockItem.objects.filter(id=item_id).first()
#item.bought_quantity = int(t)
#item.effective_quantity += int(t)
#item.save()
self.shoppinglist.todo = False
self.shoppinglist.save()
return self.cleaned_data
@ -319,7 +314,7 @@ class StockUpdateAfterShopppingBaseFormView(CounterAdminTabsMixin, CanEditMixin,
for i in self.shoppinglist.shopping_items_to_buy.filter(type=t).order_by('name').all():
field_name = "item-%s" % (str(i.id))
fields[field_name] = forms.CharField(max_length=30, required=True, label=str(i),
help_text=str(i.tobuy_quantity) + " asked")
help_text=_(str(i.tobuy_quantity) + " asked"))
kwargs['shoppinglist_id'] = self.shoppinglist.id
kwargs['base_fields'] = fields
return type('StockUpdateAfterShopppingForm', (StockUpdateAfterShopppingForm,), kwargs)
@ -385,7 +380,7 @@ class StockTakeItemsBaseFormView(CounterTabsMixin, CanEditMixin, DetailView, Bas
for t in ProductType.objects.order_by('name').all():
for i in self.stock.items.filter(type=t).order_by('name').all():
field_name = "item-%s" % (str(i.id))
fields[field_name] = forms.IntegerField(required=False, label=str(i), help_text="("+ str(i.effective_quantity) + " left)")
fields[field_name] = forms.IntegerField(required=False, label=str(i), help_text=_("("+ str(i.effective_quantity) + " left)"))
kwargs[field_name] = i.effective_quantity
kwargs['stock_id'] = self.stock.id
kwargs['counter_id'] = self.stock.counter.id