mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
Merge pull request #54956 from frappe/mergify/bp/version-15-hotfix/pr-54941
fix: flag to disable opening balance calculation in general ledger (backport #54941)
This commit is contained in:
@@ -176,10 +176,16 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldname: "disable_opening_balance_calculation",
|
||||||
|
label: __("Disable Opening Balance Calculation"),
|
||||||
|
fieldtype: "Check",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
fieldname: "show_opening_entries",
|
fieldname: "show_opening_entries",
|
||||||
label: __("Show Opening Entries"),
|
label: __("Show Opening Entries"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
|
depends_on: "eval: !doc.disable_opening_balance_calculation",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "include_default_book_entries",
|
fieldname: "include_default_book_entries",
|
||||||
|
|||||||
@@ -279,7 +279,15 @@ def get_conditions(filters):
|
|||||||
if filters.get("party"):
|
if filters.get("party"):
|
||||||
conditions.append("party in %(party)s")
|
conditions.append("party in %(party)s")
|
||||||
|
|
||||||
if not (
|
if filters.get("disable_opening_balance_calculation"):
|
||||||
|
if not ignore_is_opening:
|
||||||
|
conditions.append("(posting_date >=%(from_date)s or is_opening = 'Yes')")
|
||||||
|
else:
|
||||||
|
conditions.append("posting_date >=%(from_date)s")
|
||||||
|
|
||||||
|
# opening balance calculation is done only if filtered on account/party
|
||||||
|
# so from_date filter is not applied
|
||||||
|
elif not (
|
||||||
filters.get("account")
|
filters.get("account")
|
||||||
or filters.get("party")
|
or filters.get("party")
|
||||||
or filters.get("categorize_by") in ["Categorize by Account", "Categorize by Party"]
|
or filters.get("categorize_by") in ["Categorize by Account", "Categorize by Party"]
|
||||||
@@ -528,7 +536,11 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map, tot
|
|||||||
group_by_value = gle.get(group_by)
|
group_by_value = gle.get(group_by)
|
||||||
gle.voucher_type = gle.voucher_type
|
gle.voucher_type = gle.voucher_type
|
||||||
|
|
||||||
if gle.posting_date < from_date or (cstr(gle.is_opening) == "Yes" and not show_opening_entries):
|
if gle.posting_date < from_date or (
|
||||||
|
cstr(gle.is_opening) == "Yes"
|
||||||
|
and not show_opening_entries
|
||||||
|
and not filters.disable_opening_balance_calculation
|
||||||
|
):
|
||||||
if not group_by_voucher_consolidated:
|
if not group_by_voucher_consolidated:
|
||||||
update_value_in_dict(gle_map[group_by_value].totals, "opening", gle, True)
|
update_value_in_dict(gle_map[group_by_value].totals, "opening", gle, True)
|
||||||
update_value_in_dict(gle_map[group_by_value].totals, "closing", gle, True)
|
update_value_in_dict(gle_map[group_by_value].totals, "closing", gle, True)
|
||||||
|
|||||||
Reference in New Issue
Block a user