feat: allow to select if transfer transactions are muted or not on creation

This commit is contained in:
Herculino Trotta
2025-07-21 10:15:02 -03:00
parent dcdaf756f9
commit c2510b2261
+12 -2
View File
@@ -499,6 +499,13 @@ class TransferForm(forms.Form):
label=_("Notes"), label=_("Notes"),
) )
mute = forms.BooleanField(
label=_("Mute"),
initial=True,
required=False,
help_text=_("Muted transactions won't be displayed on monthly summaries"),
)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@@ -517,6 +524,7 @@ class TransferForm(forms.Form):
), ),
Field("description"), Field("description"),
Field("notes"), Field("notes"),
Switch("mute"),
Row( Row(
Column( Column(
Row( Row(
@@ -599,6 +607,8 @@ class TransferForm(forms.Form):
return cleaned_data return cleaned_data
def save(self): def save(self):
mute = self.cleaned_data["mute"]
from_account = self.cleaned_data["from_account"] from_account = self.cleaned_data["from_account"]
to_account = self.cleaned_data["to_account"] to_account = self.cleaned_data["to_account"]
from_amount = self.cleaned_data["from_amount"] from_amount = self.cleaned_data["from_amount"]
@@ -621,7 +631,7 @@ class TransferForm(forms.Form):
description=description, description=description,
category=from_category, category=from_category,
notes=notes, notes=notes,
mute=True, mute=mute,
) )
from_transaction.tags.set(self.cleaned_data.get("from_tags", [])) from_transaction.tags.set(self.cleaned_data.get("from_tags", []))
@@ -636,7 +646,7 @@ class TransferForm(forms.Form):
description=description, description=description,
category=to_category, category=to_category,
notes=notes, notes=notes,
mute=True, mute=mute,
) )
to_transaction.tags.set(self.cleaned_data.get("to_tags", [])) to_transaction.tags.set(self.cleaned_data.get("to_tags", []))