From 578e934b9f72b8bdbae707d9a8616549f10322e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 11 Aug 2020 18:36:47 +0800 Subject: [PATCH] Fixed the CashDefaultView to allow default cash account as 0 in the accounting application. --- accounting/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/accounting/views.py b/accounting/views.py index b889875..6f6b20b 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -59,8 +59,11 @@ class CashDefaultView(RedirectView): pattern_name = "accounting:cash" def get_redirect_url(self, *args, **kwargs): - kwargs["account"] = Account.objects.get( - code=settings.ACCOUNTING["DEFAULT_CASH_ACCOUNT"]) + code = settings.ACCOUNTING["DEFAULT_CASH_ACCOUNT"] + kwargs["account"] = Account( + code="0", + title=_("current assets and liabilities"), + ) if code == "0" else Account.objects.get(code=code) kwargs["period"] = Period.default_spec() return super().get_redirect_url(*args, **kwargs)