kfetTriArticles
This commit is contained in:
parent
340f8f16a7
commit
9d2c13e67c
|
@ -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,7 +58,14 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% regroup formset by category_name as category_list %}
|
{% regroup formset by is_sold as is_sold_list %}
|
||||||
|
{% for condition in is_sold_list %}
|
||||||
|
<tbody class="tablesorter-no-sort">
|
||||||
|
<tr class='section text-center'>
|
||||||
|
<td colspan="{{ scale|length|add:'8' }}">{% if condition.grouper %} Vendu {% else %} Non vendu {% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
{% regroup condition.list by category_name as category_list %}
|
||||||
{% for category in category_list %}
|
{% for category in category_list %}
|
||||||
<tbody class="tablesorter-no-sort">
|
<tbody class="tablesorter-no-sort">
|
||||||
<tr class='section text-left'>
|
<tr class='section text-left'>
|
||||||
|
@ -84,6 +91,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{ formset.management_form }}
|
{{ formset.management_form }}
|
||||||
|
|
|
@ -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