|
|
@ -14,7 +14,7 @@ from django.db import transaction
|
|
|
|
from django.urls import reverse
|
|
|
|
from django.urls import reverse
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
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 intervention.models import Intervention, Revocation
|
|
|
|
from konova.forms import BaseForm, BaseModalForm
|
|
|
|
from konova.forms import BaseForm, BaseModalForm
|
|
|
|
from konova.models import Document
|
|
|
|
from konova.models import Document
|
|
|
@ -568,14 +568,14 @@ class NewDeductionForm(BaseModalForm):
|
|
|
|
|
|
|
|
|
|
|
|
# Create deductions depending on Intervention or EcoAccount as the initial instance
|
|
|
|
# Create deductions depending on Intervention or EcoAccount as the initial instance
|
|
|
|
if self.is_intervention_initially:
|
|
|
|
if self.is_intervention_initially:
|
|
|
|
deduction = EcoAccountWithdraw.objects.create(
|
|
|
|
deduction = EcoAccountDeduction.objects.create(
|
|
|
|
intervention=self.instance,
|
|
|
|
intervention=self.instance,
|
|
|
|
account=self.cleaned_data["account"],
|
|
|
|
account=self.cleaned_data["account"],
|
|
|
|
surface=self.cleaned_data["surface"],
|
|
|
|
surface=self.cleaned_data["surface"],
|
|
|
|
created=user_action_create,
|
|
|
|
created=user_action_create,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
deduction = EcoAccountWithdraw.objects.create(
|
|
|
|
deduction = EcoAccountDeduction.objects.create(
|
|
|
|
intervention=self.cleaned_data["intervention"],
|
|
|
|
intervention=self.cleaned_data["intervention"],
|
|
|
|
account=self.instance,
|
|
|
|
account=self.instance,
|
|
|
|
surface=self.cleaned_data["surface"],
|
|
|
|
surface=self.cleaned_data["surface"],
|
|
|
|