mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
fix: Ignore opening entries if PCV posted
This commit is contained in:
@@ -426,6 +426,7 @@ def set_gl_entries_by_account(
|
|||||||
pluck="name",
|
pluck="name",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ignore_opening_entries = False
|
||||||
if accounts_list:
|
if accounts_list:
|
||||||
# For balance sheet
|
# For balance sheet
|
||||||
if not from_date:
|
if not from_date:
|
||||||
@@ -448,9 +449,16 @@ def set_gl_entries_by_account(
|
|||||||
last_period_closing_voucher[0].name,
|
last_period_closing_voucher[0].name,
|
||||||
)
|
)
|
||||||
from_date = add_days(last_period_closing_voucher[0].posting_date, 1)
|
from_date = add_days(last_period_closing_voucher[0].posting_date, 1)
|
||||||
|
ignore_opening_entries = True
|
||||||
|
|
||||||
gl_entries += get_accounting_entries(
|
gl_entries += get_accounting_entries(
|
||||||
"GL Entry", from_date, to_date, accounts_list, filters, ignore_closing_entries
|
"GL Entry",
|
||||||
|
from_date,
|
||||||
|
to_date,
|
||||||
|
accounts_list,
|
||||||
|
filters,
|
||||||
|
ignore_closing_entries,
|
||||||
|
ignore_opening_entries=ignore_opening_entries,
|
||||||
)
|
)
|
||||||
|
|
||||||
if filters and filters.get("presentation_currency"):
|
if filters and filters.get("presentation_currency"):
|
||||||
@@ -470,6 +478,7 @@ def get_accounting_entries(
|
|||||||
filters,
|
filters,
|
||||||
ignore_closing_entries,
|
ignore_closing_entries,
|
||||||
period_closing_voucher=None,
|
period_closing_voucher=None,
|
||||||
|
ignore_opening_entries=False,
|
||||||
):
|
):
|
||||||
gl_entry = frappe.qb.DocType(doctype)
|
gl_entry = frappe.qb.DocType(doctype)
|
||||||
query = (
|
query = (
|
||||||
@@ -489,6 +498,9 @@ def get_accounting_entries(
|
|||||||
query = query.select(gl_entry.posting_date, gl_entry.is_opening, gl_entry.fiscal_year)
|
query = query.select(gl_entry.posting_date, gl_entry.is_opening, gl_entry.fiscal_year)
|
||||||
query = query.where(gl_entry.is_cancelled == 0)
|
query = query.where(gl_entry.is_cancelled == 0)
|
||||||
query = query.where(gl_entry.posting_date <= to_date)
|
query = query.where(gl_entry.posting_date <= to_date)
|
||||||
|
|
||||||
|
if ignore_opening_entries:
|
||||||
|
query = query.where(gl_entry.is_opening == "No")
|
||||||
else:
|
else:
|
||||||
query = query.select(gl_entry.closing_date.as_("posting_date"))
|
query = query.select(gl_entry.closing_date.as_("posting_date"))
|
||||||
query = query.where(gl_entry.period_closing_voucher == period_closing_voucher)
|
query = query.where(gl_entry.period_closing_voucher == period_closing_voucher)
|
||||||
|
|||||||
Reference in New Issue
Block a user