mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Translations update
This commit is contained in:
parent
539faccab2
commit
6f88d0cf8c
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -27,10 +27,10 @@ class StockItem(models.Model):
|
|||||||
The StockItem class, element of the stock
|
The StockItem class, element of the stock
|
||||||
"""
|
"""
|
||||||
name = models.CharField(_('name'), max_length=64)
|
name = models.CharField(_('name'), max_length=64)
|
||||||
unit_quantity = models.IntegerField(_('unit quantity'), default=0, help_text='number of element in one 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')
|
effective_quantity = models.IntegerField(_('effective quantity'), default=0, help_text=_('number of box'))
|
||||||
minimal_quantity = models.IntegerField(_('minimal quantity'), default=1,
|
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,
|
type = models.ForeignKey(ProductType, related_name="stock_items", verbose_name=_("type"), null=True, blank=True,
|
||||||
on_delete=models.SET_NULL)
|
on_delete=models.SET_NULL)
|
||||||
stock_owner = models.ForeignKey(Stock, related_name="items")
|
stock_owner = models.ForeignKey(Stock, related_name="items")
|
||||||
@ -67,13 +67,13 @@ class ShoppingList(models.Model):
|
|||||||
class ShoppingListItem(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)
|
stockitem_owner = models.ForeignKey(StockItem, related_name="shopping_item", null=True)
|
||||||
name = models.CharField(_('name'), max_length=64)
|
name = models.CharField(_('name'), max_length=64)
|
||||||
type = models.ForeignKey(ProductType, related_name="shoppinglist_items", verbose_name=_("type"), null=True, blank=True,
|
type = models.ForeignKey(ProductType, related_name="shoppinglist_items", verbose_name=_("type"), null=True, blank=True,
|
||||||
on_delete=models.SET_NULL)
|
on_delete=models.SET_NULL)
|
||||||
tobuy_quantity = models.IntegerField(_('quantity to buy'), default=6, help_text="quantity to buy during the next 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")
|
bought_quantity = models.IntegerField(_('quantity bought'), default=0, help_text=_("quantity bought during the last shopping session"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s - %s" % (self.name, self.shopping_lists.first())
|
return "%s - %s" % (self.name, self.shopping_lists.first())
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h4>Other</h4>
|
<h4>{% trans %}Other{% endtrans %}</h4>
|
||||||
<br>
|
<br>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -15,7 +15,7 @@ Shopping list for {{ stock }}
|
|||||||
<br>
|
<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 %}
|
{% 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>
|
<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>
|
</p>
|
||||||
|
|
||||||
<h4>{% trans %}To do{% endtrans %}</h4>
|
<h4>{% trans %}To do{% endtrans %}</h4>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
{% from 'core/macros.jinja' import user_profile_link %}
|
{% from 'core/macros.jinja' import user_profile_link %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% trans s = stock %}Take items form {{ s }}{% endtrans %}
|
{% trans s = stock %}Take items from {{ s }}{% endtrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>{% trans s = stock %}Take items form {{ s }}{% endtrans %}</h3>
|
<h3>{% trans s = stock %}Take items from {{ s }}{% endtrans %}</h3>
|
||||||
<div>
|
<div>
|
||||||
<form method="post" action="" class="inline" style="display:inline">
|
<form method="post" action="" class="inline" style="display:inline">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -178,15 +178,15 @@ class StockItemQuantityBaseFormView(CounterAdminTabsMixin, CanEditMixin, DetailV
|
|||||||
def get_form_class(self):
|
def get_form_class(self):
|
||||||
fields = OrderedDict()
|
fields = OrderedDict()
|
||||||
kwargs = {}
|
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 t in ProductType.objects.order_by('name').all():
|
||||||
for i in self.stock.items.filter(type=t).order_by('name').all():
|
for i in self.stock.items.filter(type=t).order_by('name').all():
|
||||||
if i.effective_quantity <= i.minimal_quantity:
|
if i.effective_quantity <= i.minimal_quantity:
|
||||||
field_name = "item-%s" % (str(i.id))
|
field_name = "item-%s" % (str(i.id))
|
||||||
fields[field_name] = forms.IntegerField(required=True, label=str(i),
|
fields[field_name] = forms.IntegerField(required=True, label=str(i),
|
||||||
help_text=str(i.effective_quantity)+" left")
|
help_text=_(str(i.effective_quantity)+" left"))
|
||||||
fields['comment'] = forms.CharField(widget=forms.Textarea(), required=False,
|
fields['comment'] = forms.CharField(widget=forms.Textarea(), required=False, label=_("Comments"),
|
||||||
initial="Add here, items to buy that are not reference as a product (example : sponge, knife, mugs ...)")
|
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['stock_id'] = self.stock.id
|
||||||
kwargs['base_fields'] = fields
|
kwargs['base_fields'] = fields
|
||||||
return type('StockItemQuantityForm', (StockItemQuantityForm,), kwargs)
|
return type('StockItemQuantityForm', (StockItemQuantityForm,), kwargs)
|
||||||
@ -288,17 +288,12 @@ class StockUpdateAfterShopppingForm(forms.BaseForm):
|
|||||||
self.shoppinglist = ShoppingList.objects.filter(id=self.shoppinglist_id).first()
|
self.shoppinglist = ShoppingList.objects.filter(id=self.shoppinglist_id).first()
|
||||||
for k,t in self.cleaned_data.items():
|
for k,t in self.cleaned_data.items():
|
||||||
shoppinglist_item_id = int(k[5:])
|
shoppinglist_item_id = int(k[5:])
|
||||||
#item_id = int(k[5:])
|
|
||||||
if int(t) > 0 :
|
if int(t) > 0 :
|
||||||
shoppinglist_item = ShoppingListItem.objects.filter(id=shoppinglist_item_id).first()
|
shoppinglist_item = ShoppingListItem.objects.filter(id=shoppinglist_item_id).first()
|
||||||
shoppinglist_item.bought_quantity = int(t)
|
shoppinglist_item.bought_quantity = int(t)
|
||||||
shoppinglist_item.save()
|
shoppinglist_item.save()
|
||||||
shoppinglist_item.stockitem_owner.effective_quantity += int(t)
|
shoppinglist_item.stockitem_owner.effective_quantity += int(t)
|
||||||
shoppinglist_item.stockitem_owner.save()
|
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.todo = False
|
||||||
self.shoppinglist.save()
|
self.shoppinglist.save()
|
||||||
return self.cleaned_data
|
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():
|
for i in self.shoppinglist.shopping_items_to_buy.filter(type=t).order_by('name').all():
|
||||||
field_name = "item-%s" % (str(i.id))
|
field_name = "item-%s" % (str(i.id))
|
||||||
fields[field_name] = forms.CharField(max_length=30, required=True, label=str(i),
|
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['shoppinglist_id'] = self.shoppinglist.id
|
||||||
kwargs['base_fields'] = fields
|
kwargs['base_fields'] = fields
|
||||||
return type('StockUpdateAfterShopppingForm', (StockUpdateAfterShopppingForm,), kwargs)
|
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 t in ProductType.objects.order_by('name').all():
|
||||||
for i in self.stock.items.filter(type=t).order_by('name').all():
|
for i in self.stock.items.filter(type=t).order_by('name').all():
|
||||||
field_name = "item-%s" % (str(i.id))
|
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[field_name] = i.effective_quantity
|
||||||
kwargs['stock_id'] = self.stock.id
|
kwargs['stock_id'] = self.stock.id
|
||||||
kwargs['counter_id'] = self.stock.counter.id
|
kwargs['counter_id'] = self.stock.counter.id
|
||||||
|
Loading…
Reference in New Issue
Block a user