forked from DGNum/gestioCOF
Merge branch 'Tragicus/kfetTriArticles' into 'master'
kfet articles vendus en premier dans inventaire et commandes Closes #219 See merge request klub-dev-ens/gestioCOF!477
This commit is contained in:
commit
ab9d95055e
6 changed files with 111 additions and 25 deletions
|
@ -31,6 +31,8 @@ adhérents ni des cotisations.
|
|||
|
||||
### K-Fêt
|
||||
|
||||
- On affiche les articles actuellement en vente en premier lors des inventaires
|
||||
et des commandes.
|
||||
- On peut supprimer un inventaire. Seuls les articles dont c'est le dernier
|
||||
inventaire sont affectés.
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
66
kfet/migrations/0073_2021.py
Normal file
66
kfet/migrations/0073_2021.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Generated by Django 2.2.17 on 2021-01-06 20:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("kfet", "0072_auto_20200901_1526"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="account",
|
||||
name="promo",
|
||||
field=models.IntegerField(
|
||||
blank=True,
|
||||
choices=[
|
||||
(1980, 1980),
|
||||
(1981, 1981),
|
||||
(1982, 1982),
|
||||
(1983, 1983),
|
||||
(1984, 1984),
|
||||
(1985, 1985),
|
||||
(1986, 1986),
|
||||
(1987, 1987),
|
||||
(1988, 1988),
|
||||
(1989, 1989),
|
||||
(1990, 1990),
|
||||
(1991, 1991),
|
||||
(1992, 1992),
|
||||
(1993, 1993),
|
||||
(1994, 1994),
|
||||
(1995, 1995),
|
||||
(1996, 1996),
|
||||
(1997, 1997),
|
||||
(1998, 1998),
|
||||
(1999, 1999),
|
||||
(2000, 2000),
|
||||
(2001, 2001),
|
||||
(2002, 2002),
|
||||
(2003, 2003),
|
||||
(2004, 2004),
|
||||
(2005, 2005),
|
||||
(2006, 2006),
|
||||
(2007, 2007),
|
||||
(2008, 2008),
|
||||
(2009, 2009),
|
||||
(2010, 2010),
|
||||
(2011, 2011),
|
||||
(2012, 2012),
|
||||
(2013, 2013),
|
||||
(2014, 2014),
|
||||
(2015, 2015),
|
||||
(2016, 2016),
|
||||
(2017, 2017),
|
||||
(2018, 2018),
|
||||
(2019, 2019),
|
||||
(2020, 2020),
|
||||
(2021, 2021),
|
||||
],
|
||||
default=2020,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -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,31 +58,39 @@
|
|||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% regroup formset by category_name as category_list %}
|
||||
{% for category in category_list %}
|
||||
<tbody class="tablesorter-no-sort">
|
||||
<tr class='section text-left'>
|
||||
<td colspan="{{ scale|length|add:'8' }}">{{ category.grouper }}</td>
|
||||
{% 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>
|
||||
<tbody>
|
||||
{% for form in category.list %}
|
||||
<tr>
|
||||
{{ form.article }}
|
||||
<td class="text-left">{{ form.name }}</td>
|
||||
{% for v_chunk in form.v_all %}
|
||||
<td>{{ v_chunk }}</td>
|
||||
{% endfor %}
|
||||
<td>{{ form.v_moy }}</td>
|
||||
<td>{{ form.v_et }}</td>
|
||||
<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>
|
||||
{% regroup condition.list by category_name as category_list %}
|
||||
{% for category in category_list %}
|
||||
<tbody class="tablesorter-no-sort">
|
||||
<tr class='section text-left'>
|
||||
<td colspan="{{ scale|length|add:'8' }}">{{ category.grouper }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
{% for form in category.list %}
|
||||
<tr>
|
||||
{{ form.article }}
|
||||
<td class="text-left">{{ form.name }}</td>
|
||||
{% for v_chunk in form.v_all %}
|
||||
<td>{{ v_chunk }}</td>
|
||||
{% endfor %}
|
||||
<td>{{ form.v_moy }}</td>
|
||||
<td>{{ form.v_et }}</td>
|
||||
<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 %}
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -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