3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-05 01:16:28 +00:00

Bugs fixs

This commit is contained in:
Yoann Pétri 2018-12-05 01:43:21 +01:00
parent 183449de85
commit c831299090
10 changed files with 126 additions and 17 deletions

3
.gitignore vendored
View file

@ -39,4 +39,5 @@ tags
# End of https://www.gitignore.io/api/vim,git,django
.vscode
.vscode
venv

View file

@ -27,7 +27,6 @@ DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
# Application definition
INSTALLED_APPS = [

View file

@ -34,7 +34,7 @@ class ProductForm(forms.ModelForm):
class KegForm(forms.ModelForm):
class Meta:
model = Keg
fields = "__all__"
exclude = ("is_active", )
class MenuForm(forms.ModelForm):
class Meta:

View file

@ -0,0 +1,74 @@
# Generated by Django 2.1 on 2018-12-05 00:42
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestion', '0009_auto_20181202_1628'),
]
operations = [
migrations.AlterField(
model_name='historicalkeg',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Prix du fût'),
),
migrations.AlterField(
model_name='historicalmenu',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
migrations.AlterField(
model_name='historicalmenuhistory',
name='amount',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
migrations.AlterField(
model_name='historicalproduct',
name='adherentRequired',
field=models.BooleanField(default=True, verbose_name='Adhérent requis'),
),
migrations.AlterField(
model_name='historicalrefund',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
migrations.AlterField(
model_name='historicalreload',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
migrations.AlterField(
model_name='keg',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Prix du fût'),
),
migrations.AlterField(
model_name='menu',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
migrations.AlterField(
model_name='menuhistory',
name='amount',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
migrations.AlterField(
model_name='product',
name='adherentRequired',
field=models.BooleanField(default=True, verbose_name='Adhérent requis'),
),
migrations.AlterField(
model_name='refund',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
migrations.AlterField(
model_name='reload',
name='amount',
field=models.DecimalField(decimal_places=2, max_digits=7, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Montant'),
),
]

View file

@ -38,7 +38,7 @@ class Product(models.Model):
is_active = models.BooleanField(default=True, verbose_name="Actif")
volume = models.PositiveIntegerField(default=0)
deg = models.DecimalField(default=0,max_digits=5, decimal_places=2, verbose_name="Degré", validators=[MinValueValidator(0)])
adherentRequired = models.BooleanField(default=True)
adherentRequired = models.BooleanField(default=True, verbose_name="Adhérent requis")
history = HistoricalRecords()
def __str__(self):
@ -63,7 +63,7 @@ def isDemi(id):
)
def isGalopin(id):
product = Product.objects.get(id)
product = Product.objects.get(id=id)
if product.category != Product.G_PRESSION:
raise ValidationError(
('%(product)s n\'est pas un galopin'),
@ -84,7 +84,7 @@ class Keg(models.Model):
name = models.CharField(max_length=20, unique=True, verbose_name="Nom")
stockHold = models.IntegerField(default=0, verbose_name="Stock en soute")
barcode = models.CharField(max_length=20, unique=True, verbose_name="Code barre")
amount = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="Prix du fût", validators=[MinValueValidator(0)])
amount = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="Prix du fût", validators=[MinValueValidator(0)])
capacity = models.IntegerField(default=30, verbose_name="Capacité (L)")
pinte = models.ForeignKey(Product, on_delete=models.PROTECT, related_name="futp", validators=[isPinte])
demi = models.ForeignKey(Product, on_delete=models.PROTECT, related_name="futd", validators=[isDemi])
@ -126,7 +126,7 @@ class Reload(models.Model):
verbose_name = "Rechargement"
customer = models.ForeignKey(User, on_delete=models.PROTECT, related_name="reload_taken", verbose_name="Client")
amount = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
amount = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
PaymentMethod = models.ForeignKey(PaymentMethod, on_delete=models.PROTECT, verbose_name="Moyen de paiement")
coopeman = models.ForeignKey(User, on_delete=models.PROTECT, related_name="reload_realized")
date = models.DateTimeField(auto_now_add=True)
@ -154,7 +154,7 @@ class Refund(models.Model):
date = models.DateTimeField(auto_now_add=True)
customer = models.ForeignKey(User, on_delete=models.PROTECT, related_name="refund_taken", verbose_name="Client")
amount = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
amount = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
coopeman = models.ForeignKey(User, on_delete=models.PROTECT, related_name="refund_realized")
history = HistoricalRecords()
@ -167,7 +167,7 @@ class Menu(models.Model):
Stores menus
"""
name = models.CharField(max_length=255, verbose_name="Nom")
amount = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
amount = models.DecimalField(max_digits=7, decimal_places=2, verbose_name="Montant", validators=[MinValueValidator(0)])
barcode = models.CharField(max_length=20, unique=True, verbose_name="Code barre")
articles = models.ManyToManyField(Product, verbose_name="Produits")
is_active = models.BooleanField(default=False, verbose_name="Actif")
@ -195,7 +195,7 @@ class MenuHistory(models.Model):
paymentMethod = models.ForeignKey(PaymentMethod, on_delete=models.PROTECT)
date = models.DateTimeField(auto_now_add=True)
menu = models.ForeignKey(Menu, on_delete=models.PROTECT)
amount = models.DecimalField(max_digits=5, decimal_places=2, default=0)
amount = models.DecimalField(max_digits=7, decimal_places=2, default=0)
coopeman = models.ForeignKey(User, on_delete=models.PROTECT, related_name="menu_selled")
history = HistoricalRecords()

View file

@ -17,7 +17,7 @@
{% if perms.gestion.add_product %}
<li><a href="{% url 'gestion:addProduct' %}">Créer un produit</a></li>
{% endif %}
{% if permis.gestion.view_product}
{% if perms.gestion.view_product %}
<li><a href="{% url 'gestion:searchProduct' %}">Rechercher un produit</a></li>
<li><a href="{% url 'gestion:productsList' %}">Lister tous les produits</a></li>
{% endif %}
@ -32,13 +32,13 @@
{% if perms.gestion.add_keg %}
<li><a href="{% url 'gestion:addKeg' %}">Créer un fut</a></li>
{% endif %}
{% if perms.gestion.open_keg}
{% if perms.gestion.open_keg %}
<li><a href="{% url 'gestion:openKeg' %}">Percuter un fut</a></li>
{% endif %}
{% if perms.gestion.close_keg}
{% if perms.gestion.close_keg %}
<li><a href="{% url 'gestion:closeKeg' %}">Fermer un fût</a></li>
{% endif %}
{% if perms.gestion.view_keg}
{% if perms.gestion.view_keg %}
<li><a href="{% url 'gestion:kegsList' %}">Lister les futs</a></li>
{% endif %}
</ul>

View file

@ -0,0 +1,33 @@
# Generated by Django 2.1 on 2018-12-05 00:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0005_auto_20181202_1628'),
]
operations = [
migrations.AlterField(
model_name='historicalprofile',
name='credit',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
migrations.AlterField(
model_name='historicalprofile',
name='debit',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
migrations.AlterField(
model_name='profile',
name='credit',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
migrations.AlterField(
model_name='profile',
name='debit',
field=models.DecimalField(decimal_places=2, default=0, max_digits=7),
),
]

View file

@ -71,8 +71,8 @@ class Profile(models.Model):
verbose_name = "Profil"
user = models.OneToOneField(User, on_delete=models.CASCADE)
credit = models.DecimalField(max_digits=5, decimal_places=2, default=0)
debit = models.DecimalField(max_digits=5, decimal_places=2, default=0)
credit = models.DecimalField(max_digits=7, decimal_places=2, default=0)
debit = models.DecimalField(max_digits=7, decimal_places=2, default=0)
school = models.ForeignKey(School, on_delete=models.PROTECT, blank=True, null=True)
cotisationEnd = models.DateTimeField(blank=True, null=True)
history = HistoricalRecords()

View file

@ -16,7 +16,7 @@
</header>
Actions possibles :
<ul>
{% if perms.auth.add_user}
{% if perms.auth.add_user %}
<li><a href="{% url 'users:createUser' %}">Ajouter un utilisateur</a></li>
{% endif %}
{% if perms.auth.view_user %}

View file

@ -166,6 +166,8 @@ def createUser(request):
user.save()
user.profile.school = form.cleaned_data['school']
user.save()
messages.success(request, "L'utilisateur a bien été créé")
return redirect(reverse('users:profile', kwargs={'pk':user.pk}))
return render(request, "form.html", {"form_entete": "Gestion des utilisateurs", "form":form, "form_title":"Création d'un nouvel utilisateur", "form_button":"Créer l'utilisateur"})
@active_required