From a18721d21c9dd359721a13393e98bcbbff860d37 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Mar 2025 11:38:28 +0530 Subject: [PATCH] fix: consider stock freeze date in recalculate_amount_difference_field patch (cherry picked from commit cd7253278937f66f2c5b52bebc54f137b03068a7) (cherry picked from commit 8264d42cd9083f71752a303fded52d698d819c57) --- erpnext/patches/v15_0/recalculate_amount_difference_field.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index e4e1add6949..0f8083d8b14 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -75,6 +75,10 @@ def execute(): 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 + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): posting_date = fiscal_year[1]