Merge pull request #43913 from nabinhait/pcv-opening-entry-fix

fix: find first PCV to consider opening entries
This commit is contained in:
ruthra kumar
2024-10-30 10:24:02 +05:30
committed by GitHub

View File

@@ -413,11 +413,16 @@ class PeriodClosingVoucher(AccountsController):
return closing_entries return closing_entries
def is_first_period_closing_voucher(self): def is_first_period_closing_voucher(self):
return not frappe.db.exists( first_pcv = frappe.db.get_value(
"Period Closing Voucher", "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): def cancel_gl_entries(self):
if self.get_gle_count_against_current_pcv() > 5000: if self.get_gle_count_against_current_pcv() > 5000:
frappe.enqueue( frappe.enqueue(