Created|Deleted refactoring
* refactors base attributes created and deleted into UserActionLogEntry foreign keys * refactors all related queries and process logic * fixes binding_on into binding_date in intervention/detail/view.html * adds basic __str__ for some models *
This commit is contained in:
@@ -10,7 +10,9 @@ from django.db import transaction
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.models import Payment
|
||||
from konova.enums import UserActionLogEntryEnum
|
||||
from konova.forms import BaseForm, BaseModalForm
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class NewCompensationForm(BaseForm):
|
||||
@@ -56,8 +58,12 @@ class NewPaymentForm(BaseModalForm):
|
||||
|
||||
def save(self):
|
||||
with transaction.atomic():
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=self.user,
|
||||
action=UserActionLogEntryEnum.CREATED.value,
|
||||
)
|
||||
pay = Payment.objects.create(
|
||||
created_by=self.user,
|
||||
created=action,
|
||||
amount=self.cleaned_data.get("amount", -1),
|
||||
due_on=self.cleaned_data.get("due", None),
|
||||
comment=self.cleaned_data.get("transfer_note", None),
|
||||
|
||||
Reference in New Issue
Block a user