kfetTriArticles
This commit is contained in:
parent
340f8f16a7
commit
9d2c13e67c
4 changed files with 43 additions and 25 deletions
|
@ -558,6 +558,7 @@ class InventoryArticleForm(forms.Form):
|
||||||
self.category = kwargs["initial"]["category"]
|
self.category = kwargs["initial"]["category"]
|
||||||
self.category_name = kwargs["initial"]["category__name"]
|
self.category_name = kwargs["initial"]["category__name"]
|
||||||
self.box_capacity = kwargs["initial"]["box_capacity"]
|
self.box_capacity = kwargs["initial"]["box_capacity"]
|
||||||
|
self.is_sold = kwargs["initial"]["is_sold"]
|
||||||
|
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
|
@ -584,6 +585,7 @@ class OrderArticleForm(forms.Form):
|
||||||
self.v_et = kwargs["initial"]["v_et"]
|
self.v_et = kwargs["initial"]["v_et"]
|
||||||
self.v_prev = kwargs["initial"]["v_prev"]
|
self.v_prev = kwargs["initial"]["v_prev"]
|
||||||
self.c_rec = kwargs["initial"]["c_rec"]
|
self.c_rec = kwargs["initial"]["c_rec"]
|
||||||
|
self.is_sold = kwargs["initial"]["is_sold"]
|
||||||
|
|
||||||
|
|
||||||
class OrderArticleToInventoryForm(forms.Form):
|
class OrderArticleToInventoryForm(forms.Form):
|
||||||
|
|
|
@ -26,6 +26,12 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for form in formset %}
|
{% for form in formset %}
|
||||||
|
{% ifchanged form.is_sold %}
|
||||||
|
<tr class='section'>
|
||||||
|
<td>{% if form.is_sold %} Vendu {% else %} Non vendu {% endif %}</td>
|
||||||
|
<td colspan="7"></td>
|
||||||
|
</tr>
|
||||||
|
{% endifchanged %}
|
||||||
{% ifchanged form.category %}
|
{% ifchanged form.category %}
|
||||||
<tr class='section'>
|
<tr class='section'>
|
||||||
<td>{{ form.category_name }}</td>
|
<td>{{ form.category_name }}</td>
|
||||||
|
|
|
@ -58,31 +58,39 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% regroup formset by category_name as category_list %}
|
{% regroup formset by is_sold as is_sold_list %}
|
||||||
{% for category in category_list %}
|
{% for condition in is_sold_list %}
|
||||||
<tbody class="tablesorter-no-sort">
|
<tbody class="tablesorter-no-sort">
|
||||||
<tr class='section text-left'>
|
<tr class='section text-center'>
|
||||||
<td colspan="{{ scale|length|add:'8' }}">{{ category.grouper }}</td>
|
<td colspan="{{ scale|length|add:'8' }}">{% if condition.grouper %} Vendu {% else %} Non vendu {% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody>
|
{% regroup condition.list by category_name as category_list %}
|
||||||
{% for form in category.list %}
|
{% for category in category_list %}
|
||||||
<tr>
|
<tbody class="tablesorter-no-sort">
|
||||||
{{ form.article }}
|
<tr class='section text-left'>
|
||||||
<td class="text-left">{{ form.name }}</td>
|
<td colspan="{{ scale|length|add:'8' }}">{{ category.grouper }}</td>
|
||||||
{% for v_chunk in form.v_all %}
|
</tr>
|
||||||
<td>{{ v_chunk }}</td>
|
</tbody>
|
||||||
{% endfor %}
|
<tbody>
|
||||||
<td>{{ form.v_moy }}</td>
|
{% for form in category.list %}
|
||||||
<td>{{ form.v_et }}</td>
|
<tr>
|
||||||
<td>{{ form.v_prev }}</td>
|
{{ form.article }}
|
||||||
<td>{{ form.stock }}</td>
|
<td class="text-left">{{ form.name }}</td>
|
||||||
<td>{{ form.box_capacity|default:"" }}</td>
|
{% for v_chunk in form.v_all %}
|
||||||
<td>{{ form.c_rec }}</td>
|
<td>{{ v_chunk }}</td>
|
||||||
<td class="nopadding">{{ form.quantity_ordered|add_class:"form-control" }}</td>
|
{% endfor %}
|
||||||
</tr>
|
<td>{{ form.v_moy }}</td>
|
||||||
{% endfor %}
|
<td>{{ form.v_et }}</td>
|
||||||
</tbody>
|
<td>{{ form.v_prev }}</td>
|
||||||
|
<td>{{ form.stock }}</td>
|
||||||
|
<td>{{ form.box_capacity|default:"" }}</td>
|
||||||
|
<td>{{ form.c_rec }}</td>
|
||||||
|
<td class="nopadding">{{ form.quantity_ordered|add_class:"form-control" }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1835,12 +1835,13 @@ class InventoryList(ListView):
|
||||||
def inventory_create(request):
|
def inventory_create(request):
|
||||||
|
|
||||||
articles = Article.objects.select_related("category").order_by(
|
articles = Article.objects.select_related("category").order_by(
|
||||||
"category__name", "name"
|
"-is_sold", "category__name", "name"
|
||||||
)
|
)
|
||||||
initial = []
|
initial = []
|
||||||
for article in articles:
|
for article in articles:
|
||||||
initial.append(
|
initial.append(
|
||||||
{
|
{
|
||||||
|
"is_sold": article.is_sold,
|
||||||
"article": article.pk,
|
"article": article.pk,
|
||||||
"stock_old": article.stock,
|
"stock_old": article.stock,
|
||||||
"name": article.name,
|
"name": article.name,
|
||||||
|
@ -1960,7 +1961,7 @@ def order_create(request, pk):
|
||||||
Article.objects.filter(suppliers=supplier.pk)
|
Article.objects.filter(suppliers=supplier.pk)
|
||||||
.distinct()
|
.distinct()
|
||||||
.select_related("category")
|
.select_related("category")
|
||||||
.order_by("category__name", "name")
|
.order_by("-is_sold", "category__name", "name")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Force hit to cache
|
# Force hit to cache
|
||||||
|
@ -2017,6 +2018,7 @@ def order_create(request, pk):
|
||||||
"v_et": round(v_et),
|
"v_et": round(v_et),
|
||||||
"v_prev": round(v_prev),
|
"v_prev": round(v_prev),
|
||||||
"c_rec": article.box_capacity and c_rec or round(c_rec_tot),
|
"c_rec": article.box_capacity and c_rec or round(c_rec_tot),
|
||||||
|
"is_sold": article.is_sold
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue