mirror of
https://github.com/nanoy42/coope
synced 2024-11-22 03:13:12 +00:00
Remove barcodes
This commit is contained in:
parent
19c56ca267
commit
ce0acde3d0
10 changed files with 63 additions and 51 deletions
|
@ -49,7 +49,7 @@ class KegForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Keg
|
||||
fields = ["name", "stockHold", "barcode", "amount", "capacity"]
|
||||
fields = ["name", "stockHold", "amount", "capacity"]
|
||||
widgets = {'amount': forms.TextInput}
|
||||
|
||||
category = forms.ModelChoiceField(queryset=Category.objects.all(), label="Catégorie")
|
||||
|
|
37
gestion/migrations/0011_auto_20190623_1640.py
Normal file
37
gestion/migrations/0011_auto_20190623_1640.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 2.1 on 2019-06-23 14:40
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gestion', '0010_auto_20190623_1623'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='historicalkeg',
|
||||
name='barcode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='historicalmenu',
|
||||
name='barcode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='historicalproduct',
|
||||
name='barcode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='keg',
|
||||
name='barcode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='menu',
|
||||
name='barcode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='product',
|
||||
name='barcode',
|
||||
),
|
||||
]
|
|
@ -62,10 +62,6 @@ class Product(models.Model):
|
|||
"""
|
||||
Number of product at the bar.
|
||||
"""
|
||||
barcode = models.CharField(max_length=255, unique=True, verbose_name="Code barre")
|
||||
"""
|
||||
The barcode of the product.
|
||||
"""
|
||||
category = models.ForeignKey('Category', on_delete=models.PROTECT, verbose_name="Catégorie")
|
||||
"""
|
||||
The category of the product
|
||||
|
@ -170,10 +166,6 @@ class Keg(models.Model):
|
|||
"""
|
||||
The number of this keg in the hold.
|
||||
"""
|
||||
barcode = models.CharField(max_length=20, unique=True, verbose_name="Code barre")
|
||||
"""
|
||||
The barcode of the keg.
|
||||
"""
|
||||
amount = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="Prix du fût", validators=[MinValueValidator(0)])
|
||||
"""
|
||||
The price of the keg.
|
||||
|
@ -317,10 +309,6 @@ class Menu(models.Model):
|
|||
"""
|
||||
Price of the menu.
|
||||
"""
|
||||
barcode = models.CharField(max_length=20, unique=True, verbose_name="Code barre")
|
||||
"""
|
||||
Barcode of the menu.
|
||||
"""
|
||||
articles = models.ManyToManyField(Product, verbose_name="Produits")
|
||||
"""
|
||||
Stores :class:`Products <gestion.models.Product>` contained in the menu
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Stock en soute</th>
|
||||
<th>Code barre</th>
|
||||
<th>Capacité</th>
|
||||
<th>Quantité vendue</th>
|
||||
<th>Montant vendu</th>
|
||||
|
@ -43,7 +42,6 @@
|
|||
<tr>
|
||||
<td>{{ kegH.keg.name }}</td>
|
||||
<td>{{ kegH.keg.stockHold}}</td>
|
||||
<td>{{ kegH.keg.barcode }}</td>
|
||||
<td>{{ kegH.keg.capacity }} L</td>
|
||||
<td>{{ kegH.quantitySold }} L</td>
|
||||
<td>{{ kegH.amountSold }} €</td>
|
||||
|
@ -77,7 +75,6 @@
|
|||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Stock en soute</th>
|
||||
<th>Code barre</th>
|
||||
<th>Capacité</th>
|
||||
<th>Prix du fût</th>
|
||||
<th>Degré</th>
|
||||
|
@ -90,7 +87,6 @@
|
|||
<tr>
|
||||
<td>{{ keg.name }}</td>
|
||||
<td>{{ keg.stockHold}}</td>
|
||||
<td>{{ keg.barcode }}</td>
|
||||
<td>{{ keg.capacity }} L</td>
|
||||
<td>{{ keg.amount }} €</td>
|
||||
<td>{{ keg.pinte.deg }}°</td>
|
||||
|
|
|
@ -98,7 +98,6 @@
|
|||
<table id="productTable" type="input" name="tableau" class="alt">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>CodeBarre</th>
|
||||
<th>Nom Produit</th>
|
||||
<th>Prix Unitaire</th>
|
||||
<th>Quantité</th>
|
||||
|
@ -117,43 +116,43 @@
|
|||
<tbody class="actions" id="bouton Produit">
|
||||
<tr class="cotisation-hidden" style="text-align:center; font-weight:bold;"><td colspan="4">Cotisations</td></tr>
|
||||
{% for cotisation in cotisations %}
|
||||
{% if forloop.counter0|divisibleby:4 %}
|
||||
{% if forloop.counter0|divisibleby:3 %}
|
||||
<tr class="cotisation-hidden" style="text-align:center">
|
||||
{% endif %}
|
||||
<td class="cotisation-hidden"><button class="cotisation" target="{{cotisation.pk}}">Cotisation {{cotisation.duration}} jours ({{cotisation.amount}} €)</button></td>
|
||||
{% if forloop.counter|divisibleby:4 %}
|
||||
{% if forloop.counter|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not cotisations|divisibleby:4 %}
|
||||
{% if not cotisations|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr style="text-align:center; font-weight:bold;"><td colspan="4">Bières pression</td></tr>
|
||||
{% for product in bieresPression %}
|
||||
{% if forloop.counter0|divisibleby:4 %}
|
||||
{% if forloop.counter0|divisibleby:3 %}
|
||||
<tr style="text-align:center">
|
||||
{% endif %}
|
||||
<td><button class="product {% if product.adherentRequired %}special{% endif%}" target="{{product.pk}}">{{product}}</button></td>
|
||||
{% if forloop.counter|divisibleby:4 %}
|
||||
{% if forloop.counter|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not bieresPression|divisibleby:4 %}
|
||||
{% if not bieresPression|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for category in categories %}
|
||||
{% if category.active_products.count > 0 %}
|
||||
<tr style="text-align:center; font-weight:bold;"><td colspan="4">{{category}}</td></tr>
|
||||
{% for product in category.active_products %}
|
||||
{% if forloop.counter0|divisibleby:4 %}
|
||||
{% if forloop.counter0|divisibleby:3 %}
|
||||
<tr style="text-align:center">
|
||||
{% endif %}
|
||||
<td><button class="product {% if product.adherentRequired %}special{% endif%}" target="{{product.pk}}">{{product}}</button></td>
|
||||
{% if forloop.counter|divisibleby:4 %}
|
||||
{% if forloop.counter|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not category.active_products|divisibleby:4 %}
|
||||
{% if not category.active_products|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -161,15 +160,15 @@
|
|||
{% if menus %}
|
||||
<tr style="text-align:center; font-weight:bold;"><td colspan="4">Menus</td></tr>
|
||||
{% for product in menus %}
|
||||
{% if forloop.counter0|divisibleby:4 %}
|
||||
{% if forloop.counter0|divisibleby:3 %}
|
||||
<tr style="text-align:center">
|
||||
{% endif %}
|
||||
<td><button class="menu {% if product.adherent_required %}special{% endif%}" target="{{product.pk}}">{{product}}</button></td>
|
||||
{% if forloop.counter|divisibleby:4 %}
|
||||
{% if forloop.counter|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not menus|divisibleby:4 %}
|
||||
{% if not menus|divisibleby:3 %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Prix</th>
|
||||
<th>Code barre</th>
|
||||
<th>Produits</th>
|
||||
<th>Actif</th>
|
||||
<th>Administrer</th>
|
||||
|
@ -28,7 +27,6 @@
|
|||
<tr>
|
||||
<td>{{ menu.name }}</td>
|
||||
<td>{{ menu.amount}} €</td>
|
||||
<td>{{ menu.barcode }}</td>
|
||||
<td>{% for art in menu.articles.all %}<a href="{% url 'gestion:productProfile' art.pk %}">{{art}}</a>,{% endfor %}</td>
|
||||
<td>{{ menu.is_active | yesno:"Oui, Non"}}</td>
|
||||
<td>{% if perms.gestion.change_menu %}<a href="{% url 'gestion:switchActivateMenu' menu.pk %}" class="button small">{% if menu.is_active %}<i class="fa fa-times-cirlce"></i> Désa{% else %}<i class="fa fa-check-circle"></i> A{% endif %}ctiver</a> <a href="{% url 'gestion:editMenu' menu.pk %}" class="button small"><i class="fa fa-pencil-alt"></i> Modifier</a>{% endif %}</td>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<strong>Prix de vente</strong> : {{ product.amount }}€<br>
|
||||
<strong>Stock en soute</strong> : {{ product.stockHold }}<br>
|
||||
<strong>Stock au bar</strong> : {{ product.stockBar }}<br>
|
||||
<strong>Code Barre</strong> : {{ product.barcode }}<br>
|
||||
<strong>Catégorie</strong> : <a href="{% url 'gestion:categoryProfile' product.category.pk %}">{{ product.category }}</a><br>
|
||||
<strong>Actif</strong> : {{ product.is_active | yesno:"Oui, Non"}}<br>
|
||||
<strong>Dégré</strong> : {{ product.deg }}<br>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<th>Prix</th>
|
||||
<th>Stock (soute)</th>
|
||||
<th>Stock (bar)</th>
|
||||
<th>Code barre</th>
|
||||
<th>Catégorie</th>
|
||||
<th>Actif</th>
|
||||
<th>Degré</th>
|
||||
|
@ -36,7 +35,6 @@
|
|||
<td>{{ product.amount}}</td>
|
||||
<td>{{ product.stockHold }}</td>
|
||||
<td>{{ product.stockBar }}</td>
|
||||
<td>{{ product.barcode }}</td>
|
||||
<td>{{ product.category }}</td>
|
||||
<td>{{ product.is_active | yesno:"Oui, Non"}}</td>
|
||||
<td>{{ product.deg }}</td>
|
||||
|
|
|
@ -393,7 +393,7 @@ def productProfile(request, pk):
|
|||
@login_required
|
||||
def getProduct(request, pk):
|
||||
"""
|
||||
Get a :class:`gestion.models.Product` by barcode and return it in JSON format.
|
||||
Get a :class:`gestion.models.Product` by pk and return it in JSON format.
|
||||
|
||||
pk
|
||||
The primary key of the :class:`gestion.models.Product` to get infos.
|
||||
|
@ -403,7 +403,7 @@ def getProduct(request, pk):
|
|||
nb_pintes = 1
|
||||
else:
|
||||
nb_pintes = 0
|
||||
data = json.dumps({"pk": product.pk, "barcode" : product.barcode, "name": product.name, "amount": product.amount, "needQuantityButton": product.needQuantityButton, "nb_pintes": nb_pintes})
|
||||
data = json.dumps({"pk": product.pk, "name": product.name, "amount": product.amount, "needQuantityButton": product.needQuantityButton, "nb_pintes": nb_pintes})
|
||||
return HttpResponse(data, content_type='application/json')
|
||||
|
||||
@active_required
|
||||
|
@ -464,7 +464,6 @@ def addKeg(request):
|
|||
amount = pinte_price,
|
||||
stockHold = 0,
|
||||
stockBar = 0,
|
||||
barcode = "pinte_" + form.cleaned_data["barcode"],
|
||||
category = form.cleaned_data["category"],
|
||||
needQuantityButton = False,
|
||||
is_active = True,
|
||||
|
@ -481,7 +480,6 @@ def addKeg(request):
|
|||
amount = ceil(5*pinte_price)/10,
|
||||
stockHold = 0,
|
||||
stockBar = 0,
|
||||
barcode = "demi_" + form.cleaned_data["barcode"],
|
||||
category = form.cleaned_data["category"],
|
||||
needQuantityButton = False,
|
||||
is_active = True,
|
||||
|
@ -499,7 +497,6 @@ def addKeg(request):
|
|||
amount = ceil(2.5 * pinte_price)/10,
|
||||
stockHold = 0,
|
||||
stockBar = 0,
|
||||
barcode = "galopin_" + form.cleaned_data["barcode"],
|
||||
category = form.cleaned_data["category"],
|
||||
needQuantityButton = False,
|
||||
is_active = True,
|
||||
|
@ -758,7 +755,7 @@ def get_menu(request, pk):
|
|||
for article in menu.articles:
|
||||
if article.category == Product.DRAFT_PINTE:
|
||||
nb_pintes +=1
|
||||
data = json.dumps({"pk": menu.pk, "barcode" : menu.barcode, "name": menu.name, "amount" : menu.amount, "needQuantityButton": False, "nb_pintes": nb_pintes})
|
||||
data = json.dumps({"pk": menu.pk, "name": menu.name, "amount" : menu.amount, "needQuantityButton": False, "nb_pintes": nb_pintes})
|
||||
return HttpResponse(data, content_type='application/json')
|
||||
|
||||
class MenusAutocomplete(autocomplete.Select2QuerySetView):
|
||||
|
|
|
@ -19,14 +19,14 @@ function get_config(){
|
|||
function get_product(id){
|
||||
res = $.get("getProduct/" + id, function(data){
|
||||
nbPintes += data.nb_pintes;
|
||||
add_product(data.pk, data.barcode, data.name, data.amount, data.needQuantityButton);
|
||||
add_product(data.pk, data.name, data.amount, data.needQuantityButton);
|
||||
});
|
||||
}
|
||||
|
||||
function get_menu(id){
|
||||
res = $.get("getMenu/" + id, function(data){
|
||||
nbPintes += data.nb_pintes;
|
||||
add_menu(data.pk, data.barcode, data.name, data.amount, data.needQuantityButton);
|
||||
add_menu(data.pk, data.name, data.amount, data.needQuantityButton);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ function get_cotisation(id){
|
|||
});
|
||||
}
|
||||
|
||||
function add_product(pk, barcode, name, amount, needQuantityButton){
|
||||
function add_product(pk, name, amount, needQuantityButton){
|
||||
exist = false
|
||||
index = -1;
|
||||
for(k=0;k < products.length; k++){
|
||||
|
@ -56,12 +56,12 @@ function add_product(pk, barcode, name, amount, needQuantityButton){
|
|||
if(exist){
|
||||
products[index].quantity += quantity;
|
||||
}else{
|
||||
products.push({"pk": pk, "barcode": barcode, "name": name, "amount": amount, "quantity": quantity});
|
||||
products.push({"pk": pk, "name": name, "amount": amount, "quantity": quantity});
|
||||
}
|
||||
generate_html()
|
||||
}
|
||||
|
||||
function add_menu(pk, barcode, name, amount){
|
||||
function add_menu(pk, name, amount){
|
||||
exist = false;
|
||||
index = -1;
|
||||
for(k=0; k < menus.length; k++){
|
||||
|
@ -73,12 +73,12 @@ function add_menu(pk, barcode, name, amount){
|
|||
if(exist){
|
||||
menus[index].quantity += 1;
|
||||
}else{
|
||||
menus.push({"pk": pk, "barcode": barcode, "name": name, "amount": amount, "quantity":1});
|
||||
menus.push({"pk": pk, "name": name, "amount": amount, "quantity":1});
|
||||
}
|
||||
generate_html();
|
||||
}
|
||||
|
||||
function add_cotisation(pk, barcode, duration, amount){
|
||||
function add_cotisation(pk, duration, amount){
|
||||
exist = false;
|
||||
index = -1;
|
||||
for(k=0; k < cotisations.length; k++){
|
||||
|
@ -90,7 +90,7 @@ function add_cotisation(pk, barcode, duration, amount){
|
|||
if(exist){
|
||||
cotisations[index].quantity += 1;
|
||||
}else{
|
||||
cotisations.push({"pk": pk, "barcode": barcode, "duration": duration, "amount": amount, "quantity":1});
|
||||
cotisations.push({"pk": pk, "duration": duration, "amount": amount, "quantity":1});
|
||||
}
|
||||
generate_html();
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ function generate_html(){
|
|||
}
|
||||
for(k=0;k<products.length;k++){
|
||||
product = products[k]
|
||||
html += '<tr><td>' + product.barcode + '</td><td>' + product.name + '</td><td>' + String(product.amount) + ' €</td><td><input type="number" data-target="' + String(k) + '" onChange="updateInput(this)" value="' + String(product.quantity) + '"/></td><td>' + String(Number((product.quantity * product.amount).toFixed(2))) + ' €</td></tr>';
|
||||
html += '<tr><td>' + product.name + '</td><td>' + String(product.amount) + ' €</td><td><input type="number" data-target="' + String(k) + '" onChange="updateInput(this)" value="' + String(product.quantity) + '"/></td><td>' + String(Number((product.quantity * product.amount).toFixed(2))) + ' €</td></tr>';
|
||||
}
|
||||
for(k=0; k<menus.length;k++){
|
||||
menu = menus[k]
|
||||
html += '<tr><td>' + menu.barcode + '</td><td>' + menu.name + '</td><td>' + String(menu.amount) + ' €</td><td><input type="number" data-target="' + String(k) + '" onChange="updateMenuInput(this)" value="' + String(menu.quantity) + '"/></td><td>' + String(Number((menu.quantity * menu.amount).toFixed(2))) + ' €</td></tr>';
|
||||
html += '<tr><td>' + menu.name + '</td><td>' + String(menu.amount) + ' €</td><td><input type="number" data-target="' + String(k) + '" onChange="updateMenuInput(this)" value="' + String(menu.quantity) + '"/></td><td>' + String(Number((menu.quantity * menu.amount).toFixed(2))) + ' €</td></tr>';
|
||||
}
|
||||
$("#items").html(html)
|
||||
updateTotal();
|
||||
|
|
Loading…
Reference in a new issue