diff --git a/erpnext/stock/doctype/purchase_receipt_item/patches/recalculate_amount_difference_field.py b/erpnext/stock/doctype/purchase_receipt_item/patches/recalculate_amount_difference_field.py index 9def5aa8d3b..0222388d270 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/patches/recalculate_amount_difference_field.py +++ b/erpnext/stock/doctype/purchase_receipt_item/patches/recalculate_amount_difference_field.py @@ -7,7 +7,6 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import adjust_incom def execute(): - fiscal_year_dates = get_fiscal_year(frappe.utils.datetime.date.today()) table = frappe.qb.DocType("Purchase Receipt Item") parent = frappe.qb.DocType("Purchase Receipt") query = ( @@ -24,12 +23,10 @@ def execute(): table.qty, parent.conversion_rate, ) - .where( - (table.amount_difference_with_purchase_invoice != 0) - & (table.docstatus == 1) - & (parent.posting_date.between(fiscal_year_dates[1], fiscal_year_dates[2])) - ) + .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])) result = query.run(as_dict=True) item_wise_billed_qty = get_billed_qty_against_purchase_receipt([item.name for item in result]) diff --git a/erpnext/stock/doctype/purchase_receipt_item/patches/rename_field_from_rate_difference_to_amount_difference.py b/erpnext/stock/doctype/purchase_receipt_item/patches/rename_field_from_rate_difference_to_amount_difference.py index 44c8c49cba8..ce802b029da 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/patches/rename_field_from_rate_difference_to_amount_difference.py +++ b/erpnext/stock/doctype/purchase_receipt_item/patches/rename_field_from_rate_difference_to_amount_difference.py @@ -13,5 +13,6 @@ def execute(): "Purchase Receipt Item", "rate_difference_with_purchase_invoice", "amount_difference_with_purchase_invoice", + validate=False, ) frappe.clear_cache(doctype="Purchase Receipt Item")