Fixed and moved the account_text pseudo property from the RecurringExpenseForm form to its base RecurringItemForm form.
This commit is contained in:
parent
37a4c26f86
commit
067afdb165
@ -108,6 +108,17 @@ class RecurringItemForm(FlaskForm):
|
|||||||
description_template = StringField()
|
description_template = StringField()
|
||||||
"""The description template."""
|
"""The description template."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def account_text(self) -> str | None:
|
||||||
|
"""Returns the account text.
|
||||||
|
|
||||||
|
:return: The account text.
|
||||||
|
"""
|
||||||
|
if self.account_code.data is None:
|
||||||
|
return None
|
||||||
|
account: Account | None = Account.find_by_code(self.account_code.data)
|
||||||
|
return None if account is None else str(account)
|
||||||
|
|
||||||
|
|
||||||
class RecurringExpenseForm(RecurringItemForm):
|
class RecurringExpenseForm(RecurringItemForm):
|
||||||
"""The sub-form to add or update the recurring expenses."""
|
"""The sub-form to add or update the recurring expenses."""
|
||||||
@ -130,17 +141,6 @@ class RecurringExpenseForm(RecurringItemForm):
|
|||||||
"Please fill in the description template."))])
|
"Please fill in the description template."))])
|
||||||
"""The template for the line item description."""
|
"""The template for the line item description."""
|
||||||
|
|
||||||
@property
|
|
||||||
def account_text(self) -> str | None:
|
|
||||||
"""Returns the account text.
|
|
||||||
|
|
||||||
:return: The account text.
|
|
||||||
"""
|
|
||||||
if self.account_code.data is None:
|
|
||||||
return None
|
|
||||||
account: Account | None = Account.find_by_code(self.account_code.data)
|
|
||||||
return None if account is None else str(account)
|
|
||||||
|
|
||||||
|
|
||||||
class RecurringIncomeForm(RecurringItemForm):
|
class RecurringIncomeForm(RecurringItemForm):
|
||||||
"""The sub-form to add or update the recurring incomes."""
|
"""The sub-form to add or update the recurring incomes."""
|
||||||
|
Loading…
Reference in New Issue
Block a user