Fix error on accounting when no target_type specified

This commit is contained in:
Antoine Bartuccio 2017-05-06 21:15:44 +02:00
parent 7cb9ea40ac
commit 2ef3c0260a

View File

@ -304,6 +304,7 @@ class OperationForm(forms.ModelForm):
def clean(self):
self.cleaned_data = super(OperationForm, self).clean()
if 'target_type' in self.cleaned_data.keys():
if self.cleaned_data['target_type'] == "USER":
self.cleaned_data['target_id'] = self.cleaned_data['user'].id
elif self.cleaned_data['target_type'] == "ACCOUNT":