Skip to content

Commit

Permalink
fix: post account closing balance against pcv closing account (frappe…
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait authored Oct 29, 2024
1 parent aff63b9 commit 34295d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ def get_key(self, gle):
def get_account_closing_balances(self):
pl_closing_entries = self.get_closing_entries_for_pl_accounts()
bs_closing_entries = self.get_closing_entries_for_balance_sheet_accounts()
closing_entries = pl_closing_entries + bs_closing_entries
closing_entries_for_closing_account = self.get_closing_entries_for_closing_account()
closing_entries = pl_closing_entries + bs_closing_entries + closing_entries_for_closing_account
return closing_entries

def get_closing_entries_for_pl_accounts(self):
Expand Down Expand Up @@ -404,6 +405,13 @@ def get_closing_entry(self, account, balances, dimensions):
self.update_default_dimensions(closing_entry, dimensions)
return closing_entry

def get_closing_entries_for_closing_account(self):
closing_entries = copy.deepcopy(self.closing_account_gle)
for d in closing_entries:
d.period_closing_voucher = self.name

return closing_entries

def is_first_period_closing_voucher(self):
return not frappe.db.exists(
"Period Closing Voucher",
Expand Down Expand Up @@ -442,8 +450,7 @@ def process_gl_and_closing_entries(doc):
make_gl_entries(gl_entries, merge_entries=False)

closing_entries = doc.get_account_closing_balances()
if closing_entries:
make_closing_entries(closing_entries, doc.name, doc.company, doc.period_end_date)
make_closing_entries(closing_entries, doc.name, doc.company, doc.period_end_date)

frappe.db.set_value(doc.doctype, doc.name, "gle_processing_status", "Completed")
except Exception as e:
Expand Down
3 changes: 1 addition & 2 deletions erpnext/patches/v14_0/update_closing_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def execute():
pcv_doc = frappe.get_doc("Period Closing Voucher", pcv.name)
pcv_doc.pl_accounts_reverse_gle = get_pcv_gl_entries(pcv, gle_fields)
closing_entries = pcv_doc.get_account_closing_balances()
if closing_entries:
make_closing_entries(closing_entries, pcv.name, pcv.company, pcv.period_end_date)
make_closing_entries(closing_entries, pcv.name, pcv.company, pcv.period_end_date)

company_wise_order[pcv.company].append(pcv.period_end_date)
i += 1
Expand Down

0 comments on commit 34295d0

Please sign in to comment.