Order payments by date in refunds form
This commit is contained in:
parent
3ffde84ba4
commit
1e1846d501
1 changed files with 4 additions and 1 deletions
|
@ -15,7 +15,10 @@ class RefundForm(forms.ModelForm):
|
|||
super(RefundForm, self).__init__(*args, **kwargs)
|
||||
if self.instance:
|
||||
self.fields['payments'].initial = self.instance.payment_set.all()
|
||||
self.fields['payments'].queryset = Payment.objects.filter(Q(refund=None) | Q(refund=self.instance))
|
||||
self.fields['payments'].queryset = Payment\
|
||||
.objects\
|
||||
.filter(Q(refund=None) | Q(refund=self.instance))\
|
||||
.order_by('-date')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# Save the refund
|
||||
|
|
Loading…
Reference in a new issue