Withdraw to deduct
* refactors Models and attributes
This commit is contained in:
@@ -14,7 +14,7 @@ from django.db import transaction
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.models import EcoAccountWithdraw, EcoAccount
|
||||
from compensation.models import EcoAccountDeduction, EcoAccount
|
||||
from intervention.models import Intervention, Revocation
|
||||
from konova.forms import BaseForm, BaseModalForm
|
||||
from konova.models import Document
|
||||
@@ -568,14 +568,14 @@ class NewDeductionForm(BaseModalForm):
|
||||
|
||||
# Create deductions depending on Intervention or EcoAccount as the initial instance
|
||||
if self.is_intervention_initially:
|
||||
deduction = EcoAccountWithdraw.objects.create(
|
||||
deduction = EcoAccountDeduction.objects.create(
|
||||
intervention=self.instance,
|
||||
account=self.cleaned_data["account"],
|
||||
surface=self.cleaned_data["surface"],
|
||||
created=user_action_create,
|
||||
)
|
||||
else:
|
||||
deduction = EcoAccountWithdraw.objects.create(
|
||||
deduction = EcoAccountDeduction.objects.create(
|
||||
intervention=self.cleaned_data["intervention"],
|
||||
account=self.instance,
|
||||
surface=self.cleaned_data["surface"],
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.withdraws.count}}</span>
|
||||
<span class="badge badge-light">{{intervention.deductions.count}}</span>
|
||||
{% trans 'Eco Account Deductions' %}
|
||||
</h5>
|
||||
</div>
|
||||
@@ -39,7 +39,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for deduction in intervention.withdraws.all %}
|
||||
{% for deduction in intervention.deductions.all %}
|
||||
<tr {% if deduction.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Deduction invalid!' %}" {% elif not deduction.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Deduction invalid!' %}" {% endif %}>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:acc-open' deduction.account.id %}">
|
||||
|
||||
Reference in New Issue
Block a user