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_name = kwargs["initial"]["category__name"]
|
||||
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_prev = kwargs["initial"]["v_prev"]
|
||||
self.c_rec = kwargs["initial"]["c_rec"]
|
||||
self.is_sold = kwargs["initial"]["is_sold"]
|
||||
|
||||
|
||||
class OrderArticleToInventoryForm(forms.Form):
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{% 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 %}
|
||||
<tr class='section'>
|
||||
<td>{{ form.category_name }}</td>
|
||||
|
|
|
@ -58,7 +58,14 @@
|
|||
{% endfor %}
|
||||
</tr>
|
||||
</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 %}
|
||||
<tbody class="tablesorter-no-sort">
|
||||
<tr class='section text-left'>
|
||||
|
@ -84,6 +91,7 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{{ formset.management_form }}
|
||||
|
|
|
@ -1835,12 +1835,13 @@ class InventoryList(ListView):
|
|||
def inventory_create(request):
|
||||
|
||||
articles = Article.objects.select_related("category").order_by(
|
||||
"category__name", "name"
|
||||
"-is_sold", "category__name", "name"
|
||||
)
|
||||
initial = []
|
||||
for article in articles:
|
||||
initial.append(
|
||||
{
|
||||
"is_sold": article.is_sold,
|
||||
"article": article.pk,
|
||||
"stock_old": article.stock,
|
||||
"name": article.name,
|
||||
|
@ -1960,7 +1961,7 @@ def order_create(request, pk):
|
|||
Article.objects.filter(suppliers=supplier.pk)
|
||||
.distinct()
|
||||
.select_related("category")
|
||||
.order_by("category__name", "name")
|
||||
.order_by("-is_sold", "category__name", "name")
|
||||
)
|
||||
|
||||
# Force hit to cache
|
||||
|
@ -2017,6 +2018,7 @@ def order_create(request, pk):
|
|||
"v_et": round(v_et),
|
||||
"v_prev": round(v_prev),
|
||||
"c_rec": article.box_capacity and c_rec or round(c_rec_tot),
|
||||
"is_sold": article.is_sold
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue