fix: find first PCV to consider opening entries

(cherry picked from commit 2201fc62a2)
This commit is contained in:
Nabin Hait
2024-10-30 00:25:18 +05:30
committed by Mergify
parent 302f049025
commit 8218ca990c

View File

@@ -413,11 +413,16 @@ class PeriodClosingVoucher(AccountsController):
return closing_entries
def is_first_period_closing_voucher(self):
return not frappe.db.exists(
first_pcv = frappe.db.get_value(
"Period Closing Voucher",
{"company": self.company, "docstatus": 1, "name": ("!=", self.name)},
{"company": self.company, "docstatus": 1},
"name",
order_by="period_end_date",
)
if not first_pcv or first_pcv == self.name:
return True
def cancel_gl_entries(self):
if self.get_gle_count_against_current_pcv() > 5000:
frappe.enqueue(