mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Forms initial quantity addition
This commit is contained in:
parent
6f88d0cf8c
commit
7d10c5d837
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2017-01-07 13:15+0100\n"
|
"POT-Creation-Date: 2017-01-12 15:49+0100\n"
|
||||||
"PO-Revision-Date: 2016-07-18\n"
|
"PO-Revision-Date: 2016-07-18\n"
|
||||||
"Last-Translator: Skia <skia@libskia.so>\n"
|
"Last-Translator: Skia <skia@libskia.so>\n"
|
||||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||||
@ -2386,7 +2386,7 @@ msgstr "Stats"
|
|||||||
#: stock/templates/stock/stock_item_list.jinja:11
|
#: stock/templates/stock/stock_item_list.jinja:11
|
||||||
#: stock/templates/stock/stock_list.jinja:16
|
#: stock/templates/stock/stock_list.jinja:16
|
||||||
msgid "Shopping lists"
|
msgid "Shopping lists"
|
||||||
msgstr "Liste de course"
|
msgstr "Liste de courses"
|
||||||
|
|
||||||
#: core/templates/core/user_tools.jinja:46
|
#: core/templates/core/user_tools.jinja:46
|
||||||
#: counter/templates/counter/counter_list.jinja:39
|
#: counter/templates/counter/counter_list.jinja:39
|
||||||
@ -3703,7 +3703,7 @@ msgstr "nombre d'éléments dans une boite"
|
|||||||
|
|
||||||
#: stock/models.py:31
|
#: stock/models.py:31
|
||||||
msgid "effective quantity"
|
msgid "effective quantity"
|
||||||
msgstr "qunatité effective"
|
msgstr "quantité effective"
|
||||||
|
|
||||||
#: stock/models.py:31
|
#: stock/models.py:31
|
||||||
msgid "number of box"
|
msgid "number of box"
|
||||||
@ -3758,7 +3758,7 @@ msgstr "Quantité demandée"
|
|||||||
msgid "Quantity bought"
|
msgid "Quantity bought"
|
||||||
msgstr "Quantité achetée"
|
msgstr "Quantité achetée"
|
||||||
|
|
||||||
#: stock/templates/stock/shopping_list_items.jinja:42 stock/views.py:188
|
#: stock/templates/stock/shopping_list_items.jinja:42 stock/views.py:181
|
||||||
msgid "Comments"
|
msgid "Comments"
|
||||||
msgstr "Commentaires"
|
msgstr "Commentaires"
|
||||||
|
|
||||||
@ -3861,27 +3861,27 @@ msgstr "Mettre à jour les quantités de %(s)s après les courses"
|
|||||||
msgid "Update stock quantities"
|
msgid "Update stock quantities"
|
||||||
msgstr "Mettre à jour les quantités du stock"
|
msgstr "Mettre à jour les quantités du stock"
|
||||||
|
|
||||||
#: stock/views.py:181
|
#: stock/views.py:173
|
||||||
msgid "Shopping list name"
|
msgid "Shopping list name"
|
||||||
msgstr "Nom de la liste de course"
|
msgstr "Nom de la liste de courses"
|
||||||
|
|
||||||
#: stock/views.py:187
|
#: stock/views.py:179
|
||||||
msgid " left"
|
msgid " left"
|
||||||
msgstr " restant(s)"
|
msgstr " restant(s)"
|
||||||
|
|
||||||
#: stock/views.py:189
|
#: stock/views.py:180
|
||||||
msgid ""
|
msgid ""
|
||||||
"Add here, items to buy that are not reference as a stock item (example : "
|
"Add here, items to buy that are not reference as a stock item (example : "
|
||||||
"sponge, knife, mugs ...)"
|
"sponge, knife, mugs ...)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Ajouter ici les éléments à acheter qui ne sont pas référencés comme un "
|
"Ajouter ici les éléments à acheter qui ne sont pas référencés comme un "
|
||||||
"élément du stock (exemple : éponges, couteaux, tasses ..."
|
"élément du stock (exemple : éponges, couteaux, tasses ...)"
|
||||||
|
|
||||||
#: stock/views.py:317
|
#: stock/views.py:309
|
||||||
msgid " asked"
|
msgid " asked"
|
||||||
msgstr " demandé(s)"
|
msgstr " demandé(s)"
|
||||||
|
|
||||||
#: stock/views.py:383
|
#: stock/views.py:376
|
||||||
msgid "("
|
msgid "("
|
||||||
msgstr "("
|
msgstr "("
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
<h4>{{ t }}</h4>
|
<h4>{{ t }}</h4>
|
||||||
<ul>
|
<ul>
|
||||||
{% for i in stock.items.filter(type=t).order_by('name') %}
|
{% for i in stock.items.filter(type=t).order_by('name') %}
|
||||||
<li><a href="{{ url('stock:edit_item', item_id=i.id)}}">{{ i }}</a></li>
|
<li><a href="{{ url('stock:edit_item', item_id=i.id)}}">{{ i }} ({{ i.effective_quantity }} {% trans %}left{% endtrans %})</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h4>{% trans %}Others{% endtrans %}</h4>
|
<h4>{% trans %}Others{% endtrans %}</h4>
|
||||||
<ul>
|
<ul>
|
||||||
{% for i in stock.items.filter(type=None).order_by('name') %}
|
{% for i in stock.items.filter(type=None).order_by('name') %}
|
||||||
<li><a href="{{ url('stock:edit_item', item_id=i.id)}}">{{ i }}</a></li>
|
<li><a href="{{ url('stock:edit_item', item_id=i.id)}}">{{ i }} ({{ i.effective_quantity }} {% trans %}left{% endtrans %})</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -41,9 +41,6 @@ class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
|||||||
template_name = 'stock/stock_list.jinja'
|
template_name = 'stock/stock_list.jinja'
|
||||||
current_tab = "stocks"
|
current_tab = "stocks"
|
||||||
|
|
||||||
def can_be_viewed_by(self, user):
|
|
||||||
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
|
||||||
|
|
||||||
|
|
||||||
class StockEditForm(forms.ModelForm):
|
class StockEditForm(forms.ModelForm):
|
||||||
"""
|
"""
|
||||||
@ -65,16 +62,11 @@ class StockEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
|||||||
An edit view for the stock
|
An edit view for the stock
|
||||||
"""
|
"""
|
||||||
model = Stock
|
model = Stock
|
||||||
form_class = StockEditForm
|
form_class = modelform_factory(Stock, fields=['name', 'counter'])
|
||||||
pk_url_kwarg = "stock_id"
|
pk_url_kwarg = "stock_id"
|
||||||
|
template_name = 'core/edit.jinja'
|
||||||
current_tab = "stocks"
|
current_tab = "stocks"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
context = super(StockItemList, self).get_context_data(**kwargs)
|
|
||||||
if 'stock' in self.request.GET.keys():
|
|
||||||
context['stock'] = Stock.objects.filter(id=self.request.GET['stock']).first()
|
|
||||||
return context
|
|
||||||
|
|
||||||
|
|
||||||
class StockItemEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
class StockItemEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||||
"""
|
"""
|
||||||
@ -183,10 +175,10 @@ class StockItemQuantityBaseFormView(CounterAdminTabsMixin, CanEditMixin, DetailV
|
|||||||
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), initial=0,
|
||||||
help_text=_(str(i.effective_quantity)+" left"))
|
help_text=_(str(i.effective_quantity)+" left"))
|
||||||
fields['comment'] = forms.CharField(widget=forms.Textarea(), required=False, label=_("Comments"),
|
fields['comment'] = forms.CharField(widget=forms.Textarea(attrs={"placeholder":_("Add here, items to buy that are not reference as a stock item (example : sponge, knife, mugs ...)")}),
|
||||||
initial=_("Add here, items to buy that are not reference as a stock item (example : sponge, knife, mugs ...)"))
|
required=False, label=_("Comments"))
|
||||||
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)
|
||||||
@ -380,7 +372,8 @@ 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), initial=0, min_value=0, max_value=i.effective_quantity,
|
||||||
|
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