Fixed the records pseudo property of the Transaction data model to find the records only for existing transactions, to work with Django 4.1.
This commit is contained in:
parent
86b84bef7a
commit
4afd072cc5
@ -303,8 +303,11 @@ class Transaction(DirtyFieldsMixin, StampedModel, RandomPkModel):
|
|||||||
List[Record]: The records.
|
List[Record]: The records.
|
||||||
"""
|
"""
|
||||||
if self._records is None:
|
if self._records is None:
|
||||||
self._records = list(self.record_set.all())
|
if self.pk is None:
|
||||||
self._records.sort(key=lambda x: (x.is_credit, x.ord))
|
self._records = []
|
||||||
|
else:
|
||||||
|
self._records = list(self.record_set.all())
|
||||||
|
self._records.sort(key=lambda x: (x.is_credit, x.ord))
|
||||||
return self._records
|
return self._records
|
||||||
|
|
||||||
@records.setter
|
@records.setter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user