Reordered the methods in the JournalEntryLineItem data model.

This commit is contained in:
依瑪貓 2023-04-08 14:05:19 +08:00
parent a3507494e5
commit a8f318b0bb

View File

@ -722,14 +722,6 @@ class JournalEntryLineItem(db.Model):
""" """
return self.account.code return self.account.code
@property
def debit(self) -> Decimal | None:
"""Returns the debit amount.
:return: The debit amount, or None if this is not a debit line item.
"""
return self.amount if self.is_debit else None
@property @property
def is_need_offset(self) -> bool: def is_need_offset(self) -> bool:
"""Returns whether the line item needs offset. """Returns whether the line item needs offset.
@ -744,6 +736,14 @@ class JournalEntryLineItem(db.Model):
return False return False
return True return True
@property
def debit(self) -> Decimal | None:
"""Returns the debit amount.
:return: The debit amount, or None if this is not a debit line item.
"""
return self.amount if self.is_debit else None
@property @property
def credit(self) -> Decimal | None: def credit(self) -> Decimal | None:
"""Returns the credit amount. """Returns the credit amount.