forked from DGNum/gestioCOF
Add logic in views and templates
This commit is contained in:
parent
20ceec0e64
commit
affdf43e0b
3 changed files with 7 additions and 2 deletions
|
@ -236,7 +236,7 @@ class CheckoutStatementUpdateForm(forms.ModelForm):
|
||||||
class CategoryForm(forms.ModelForm):
|
class CategoryForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ArticleCategory
|
model = ArticleCategory
|
||||||
fields = ["name", "has_addcost"]
|
fields = ["name", "has_addcost", "has_reduction"]
|
||||||
|
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<td>Nom</td>
|
<td>Nom</td>
|
||||||
<td class="text-right">Nombre d'articles</td>
|
<td class="text-right">Nombre d'articles</td>
|
||||||
<td class="text-right" data-sorter="yesno">Peut être majorée</td>
|
<td class="text-right" data-sorter="yesno">Peut être majorée</td>
|
||||||
|
<td class="text-right" data-sorter="yesno">Réduction COF appliquée</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">{{ category.articles.all|length }}</td>
|
<td class="text-right">{{ category.articles.all|length }}</td>
|
||||||
<td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
|
<td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
|
||||||
|
<td class="text-right">{{ category.has_reduction | yesno:"Oui,Non"}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1056,7 +1056,10 @@ def kpsul_perform_operations(request):
|
||||||
to_addcost_for_balance += operation.addcost_amount
|
to_addcost_for_balance += operation.addcost_amount
|
||||||
if operationgroup.on_acc.is_cash:
|
if operationgroup.on_acc.is_cash:
|
||||||
to_checkout_balance += -operation.amount
|
to_checkout_balance += -operation.amount
|
||||||
if operationgroup.on_acc.is_cof:
|
if (
|
||||||
|
operationgroup.on_acc.is_cof
|
||||||
|
and operation.article.category.has_reduction
|
||||||
|
):
|
||||||
if is_addcost and operation.article.category.has_addcost:
|
if is_addcost and operation.article.category.has_addcost:
|
||||||
operation.addcost_amount /= cof_grant_divisor
|
operation.addcost_amount /= cof_grant_divisor
|
||||||
operation.amount = operation.amount / cof_grant_divisor
|
operation.amount = operation.amount / cof_grant_divisor
|
||||||
|
|
Loading…
Reference in a new issue