From 5e06e4accefcff184e3e5b2477cc04c1b60eace2 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 5 Mar 2025 16:32:26 +0530 Subject: [PATCH] fix: patch --- .../patches/v15_0/recalculate_amount_difference_field.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index 5ece5f08ddb..fa45211be94 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -25,8 +25,11 @@ def execute(): ) .where((table.amount_difference_with_purchase_invoice != 0) & (table.docstatus == 1)) ) - if fiscal_year_dates := get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False): - query.where(parent.posting_date.between(fiscal_year_dates[1], fiscal_year_dates[2])) + try: + if fiscal_year_dates := get_fiscal_year(frappe.utils.datetime.date.today()): + query.where(parent.posting_date.between(fiscal_year_dates[1], fiscal_year_dates[2])) + except Exception: + return if result := query.run(as_dict=True): item_wise_billed_qty = get_billed_qty_against_purchase_receipt([item.name for item in result])