Merge pull request #46402 from frappe/mergify/bp/version-15-hotfix/pr-46395

fix: consider account freeze date in recalculate_amount_difference_fi… (backport #46395)
This commit is contained in:
rohitwaghchaure
2025-03-08 22:45:06 +05:30
committed by GitHub

View File

@@ -62,6 +62,14 @@ def execute():
):
posting_date = period_closing_voucher[0].period_end_date
acc_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto")
if acc_frozen_upto and getdate(acc_frozen_upto) > getdate(posting_date):
posting_date = acc_frozen_upto
stock_frozen_upto = frappe.db.get_single_value("Stock Settings", "stock_frozen_upto")
if stock_frozen_upto and getdate(stock_frozen_upto) > getdate(posting_date):
posting_date = stock_frozen_upto
try:
fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today())
except Exception:
@@ -69,6 +77,7 @@ def execute():
else:
if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date):
posting_date = fiscal_year[1]
query = query.where(parent.posting_date > posting_date)
if result := query.run(as_dict=True):