Added the base account detail page that shows its descendant accounts.

This commit is contained in:
2023-02-01 16:54:45 +08:00
parent cb0dea58f1
commit 9b22331a5a
6 changed files with 121 additions and 8 deletions

View File

@ -42,6 +42,8 @@ class BaseAccount(db.Model):
l10n = db.relationship("BaseAccountL10n", back_populates="account",
lazy=False)
"""The localized titles."""
accounts = db.relationship("Account", back_populates="base")
"""The descendant accounts under the base account."""
def __str__(self) -> str:
"""Returns the string representation of the base account.
@ -91,7 +93,7 @@ class Account(db.Model):
ondelete="CASCADE"),
nullable=False)
"""The code of the base account."""
base = db.relationship(BaseAccount)
base = db.relationship(BaseAccount, back_populates="accounts")
"""The base account."""
no = db.Column(db.Integer, nullable=False, default=text("1"))
"""The account number under the base account."""