From 005f9083aaec426b02b8a1af7b84b7410320b942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Wed, 8 Mar 2023 12:16:49 +0800 Subject: [PATCH] Revised the constructor of the IncomeExpensesAccount pseudo account. --- src/accounting/report/income_expense_account.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/accounting/report/income_expense_account.py b/src/accounting/report/income_expense_account.py index f9b5a90..dd7a75e 100644 --- a/src/accounting/report/income_expense_account.py +++ b/src/accounting/report/income_expense_account.py @@ -33,21 +33,15 @@ class IncomeExpensesAccount: :param account: The actual account. """ - self.account: Account | None = None - self.id: int | None = None + self.account: Account | None = account + self.id: int = -1 if account is None else account.id """The ID.""" - self.code: str | None = None + self.code: str = "" if account is None else account.code """The code.""" - self.title: str | None = None + self.title: str = "" if account is None else account.title """The title.""" - self.str: str = "" + self.str: str = "" if account is None else str(account) """The string representation of the account.""" - if account is not None: - self.account = account - self.id = account.id - self.code = account.code - self.title = account.title - self.str = str(account) def __str__(self) -> str: """Returns the string representation of the account.