Replaced the hard-coded cash account codes with the CASH constant and the cash() method of the Account data model.
This commit is contained in:
parent
47e8944f06
commit
329e3d5362
@ -588,7 +588,7 @@ class Transaction(db.Model):
|
|||||||
for currency in self.currencies:
|
for currency in self.currencies:
|
||||||
if len(currency.debit) > 1:
|
if len(currency.debit) > 1:
|
||||||
return False
|
return False
|
||||||
if currency.debit[0].account.code != "1111-001":
|
if currency.debit[0].account.code != Account.CASH:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ class Transaction(db.Model):
|
|||||||
for currency in self.currencies:
|
for currency in self.currencies:
|
||||||
if len(currency.credit) > 1:
|
if len(currency.credit) > 1:
|
||||||
return False
|
return False
|
||||||
if currency.credit[0].account.code != "1111-001":
|
if currency.credit[0].account.code != Account.CASH:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ class ReportChooser:
|
|||||||
Currency, default_currency_code()) \
|
Currency, default_currency_code()) \
|
||||||
if currency is None else currency
|
if currency is None else currency
|
||||||
"""The currency."""
|
"""The currency."""
|
||||||
self.__account: Account = Account.find_by_code("1111-001") \
|
self.__account: Account = Account.cash() if account is None \
|
||||||
if account is None else account
|
else account
|
||||||
"""The currency."""
|
"""The currency."""
|
||||||
self.__reports: list[OptionLink] = []
|
self.__reports: list[OptionLink] = []
|
||||||
"""The links to the reports."""
|
"""The links to the reports."""
|
||||||
@ -110,7 +110,7 @@ class ReportChooser:
|
|||||||
"""
|
"""
|
||||||
account: Account = self.__account
|
account: Account = self.__account
|
||||||
if not re.match(r"[12][12]", account.base_code):
|
if not re.match(r"[12][12]", account.base_code):
|
||||||
account: Account = Account.find_by_code("1111-001")
|
account: Account = Account.cash()
|
||||||
url: str = url_for("accounting.report.income-expenses-default",
|
url: str = url_for("accounting.report.income-expenses-default",
|
||||||
currency=self.__currency, account=account) \
|
currency=self.__currency, account=account) \
|
||||||
if self.__period.is_default \
|
if self.__period.is_default \
|
||||||
|
Loading…
Reference in New Issue
Block a user