fix: Don't validate if no GL Entry exists

This commit is contained in:
Deepesh Garg 2023-03-23 15:32:24 +05:30
parent fa991b2dcf
commit 528ab503f2

View File

@ -99,6 +99,11 @@ class PeriodClosingVoucher(AccountsController):
previous_fiscal_year = get_fiscal_year(last_year_closing, company=self.company, boolean=True)
if previous_fiscal_year and not frappe.db.exists(
"GL Entry", {"posting_date": ("<=", last_year_closing), "company": self.company}
):
return
if previous_fiscal_year and not frappe.db.exists(
"Period Closing Voucher",
{"posting_date": ("<=", last_year_closing), "docstatus": 1, "company": self.company},