1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

Manage remittance types

This commit is contained in:
Yohann D'ANELLO
2020-03-24 17:06:50 +01:00
parent 1b03eac95b
commit 4cf1047faa
11 changed files with 153 additions and 66 deletions

View File

@ -49,8 +49,8 @@ class RemittanceForm(forms.ModelForm):
self.helper = FormHelper()
if self.instance.pk:
self.fields["type"].disabled = True
self.fields["type"].required = False
self.fields["remittance_type"].disabled = True
self.fields["remittance_type"].required = False
if not self.instance.closed:
self.helper.add_input(Submit('submit', _("Submit"), attr={'class': 'btn btn-block btn-primary'}))
@ -66,8 +66,8 @@ class RemittanceForm(forms.ModelForm):
cleaned_data = super().clean()
if "type" in self.changed_data:
self.add_error("type", _("You can't change the type of the remittance."))
if self.instance.pk and cleaned_data.get("remittance_type") != self.instance.remittance_type:
self.add_error("remittance_type", _("You can't change the type of the remittance."))
if "close" in self.data:
self.instance.closed = True
@ -77,7 +77,7 @@ class RemittanceForm(forms.ModelForm):
class Meta:
model = Remittance
fields = ('type', 'comment', )
fields = ('remittance_type', 'comment',)
class LinkTransactionToRemittanceForm(forms.ModelForm):