fix: Trailing opening entries in Accounts closing balance (#36175)
This commit is contained in:
parent
07d2b896c1
commit
fbea61bbc6
@ -14,10 +14,8 @@ class AccountClosingBalance(Document):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def make_closing_entries(closing_entries, voucher_name):
|
def make_closing_entries(closing_entries, voucher_name, company, closing_date):
|
||||||
accounting_dimensions = get_accounting_dimensions()
|
accounting_dimensions = get_accounting_dimensions()
|
||||||
company = closing_entries[0].get("company")
|
|
||||||
closing_date = closing_entries[0].get("closing_date")
|
|
||||||
|
|
||||||
previous_closing_entries = get_previous_closing_entries(
|
previous_closing_entries = get_previous_closing_entries(
|
||||||
company, closing_date, accounting_dimensions
|
company, closing_date, accounting_dimensions
|
||||||
|
|||||||
@ -133,6 +133,8 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
gl_entries=gl_entries,
|
gl_entries=gl_entries,
|
||||||
closing_entries=closing_entries,
|
closing_entries=closing_entries,
|
||||||
voucher_name=self.name,
|
voucher_name=self.name,
|
||||||
|
company=self.company,
|
||||||
|
closing_date=self.posting_date,
|
||||||
queue="long",
|
queue="long",
|
||||||
)
|
)
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
@ -140,7 +142,7 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
alert=True,
|
alert=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
process_gl_entries(gl_entries, closing_entries, voucher_name=self.name)
|
process_gl_entries(gl_entries, closing_entries, self.name, self.company, self.posting_date)
|
||||||
|
|
||||||
def get_grouped_gl_entries(self, get_opening_entries=False):
|
def get_grouped_gl_entries(self, get_opening_entries=False):
|
||||||
closing_entries = []
|
closing_entries = []
|
||||||
@ -321,7 +323,7 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
return query.run(as_dict=1)
|
return query.run(as_dict=1)
|
||||||
|
|
||||||
|
|
||||||
def process_gl_entries(gl_entries, closing_entries, voucher_name=None):
|
def process_gl_entries(gl_entries, closing_entries, voucher_name, company, closing_date):
|
||||||
from erpnext.accounts.doctype.account_closing_balance.account_closing_balance import (
|
from erpnext.accounts.doctype.account_closing_balance.account_closing_balance import (
|
||||||
make_closing_entries,
|
make_closing_entries,
|
||||||
)
|
)
|
||||||
@ -329,7 +331,7 @@ def process_gl_entries(gl_entries, closing_entries, voucher_name=None):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
make_gl_entries(gl_entries, merge_entries=False)
|
make_gl_entries(gl_entries, merge_entries=False)
|
||||||
make_closing_entries(gl_entries + closing_entries, voucher_name=voucher_name)
|
make_closing_entries(gl_entries + closing_entries, voucher_name, company, closing_date)
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Completed"
|
"Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Completed"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -69,7 +69,6 @@ def execute():
|
|||||||
|
|
||||||
entries = gl_entries + closing_entries
|
entries = gl_entries + closing_entries
|
||||||
|
|
||||||
if entries:
|
make_closing_entries(entries, pcv.name, pcv.company, pcv.posting_date)
|
||||||
make_closing_entries(entries, voucher_name=pcv.name)
|
company_wise_order[pcv.company].append(pcv.posting_date)
|
||||||
i += 1
|
i += 1
|
||||||
company_wise_order[pcv.company].append(pcv.posting_date)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user