forked from DGNum/gestioCOF
Correctifs
- Fix: décommente du code nécessaire et nom plus identifiable - Fix: erreur de types dans les modèles OperationGroup et Operation
This commit is contained in:
parent
6be65df654
commit
ffc845aefa
3 changed files with 35 additions and 11 deletions
|
@ -139,10 +139,9 @@ class KPsulOperationForm(forms.ModelForm):
|
|||
class Meta:
|
||||
model = Operation
|
||||
fields = ['type', 'amount', 'is_checkout', 'article', 'article_nb']
|
||||
"""
|
||||
OperationFormSet = modelformset_factory(
|
||||
|
||||
KPsulOperationFormSet = modelformset_factory(
|
||||
Operation,
|
||||
form = KPsulOperationForm,
|
||||
extra = 0,
|
||||
min_num = 1, validate_min = True)
|
||||
"""
|
||||
|
|
30
kfet/migrations/0010_auto_20160806_2343.py
Normal file
30
kfet/migrations/0010_auto_20160806_2343.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('kfet', '0009_auto_20160805_0720'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='operation',
|
||||
name='addcost_amount',
|
||||
field=models.DecimalField(max_digits=6, default=0, decimal_places=2),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='operationgroup',
|
||||
name='amount',
|
||||
field=models.DecimalField(max_digits=6, default=0, decimal_places=2),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='operationgroup',
|
||||
name='valid_by',
|
||||
field=models.ForeignKey(default=None, related_name='+', to='kfet.Account', blank=True, null=True, on_delete=django.db.models.deletion.PROTECT),
|
||||
),
|
||||
]
|
|
@ -361,12 +361,7 @@ def kpsul(request):
|
|||
data['operationgroup_form'] = KPsulOperationGroupForm()
|
||||
data['trigramme_form'] = KPsulAccountForm()
|
||||
data['checkout_form'] = KPsulCheckoutForm()
|
||||
OperationFormSet = modelformset_factory(
|
||||
Operation,
|
||||
form = KPsulOperationForm,
|
||||
extra = 0,
|
||||
min_num = 1, validate_min = True)
|
||||
operation_formset = OperationFormSet(queryset=Operation.objects.none())
|
||||
operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none())
|
||||
data['operation_formset'] = operation_formset
|
||||
return render(request, 'kfet/kpsul.html', data)
|
||||
|
||||
|
@ -408,8 +403,8 @@ def kpsul_perform_operations(request):
|
|||
return JsonResponse(data, status=400)
|
||||
|
||||
operationgroup_form = KPsulOperationGroupForm(request.POST)
|
||||
operationgroup = operationgroup_form.save(commit = False)
|
||||
operation_formset = OperationFormSet(request.POST)
|
||||
operationgroup = operationgroup_form.save(commit = False)
|
||||
operation_formset = KPsulOperationFormSet(request.POST)
|
||||
operations = operation_formset.save(commit = False)
|
||||
for operation in operations:
|
||||
operationgroup.amount += operation.amount
|
||||
|
|
Loading…
Reference in a new issue