diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 5f4c3672228..16390f19780 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -413,4 +413,5 @@ erpnext.patches.v15_0.update_pick_list_fields erpnext.patches.v15_0.update_pegged_currencies erpnext.patches.v15_0.set_company_on_pos_inv_merge_log erpnext.patches.v15_0.rename_price_list_to_buying_price_list +erpnext.patches.v15_0.patch_missing_buying_price_list_in_material_request erpnext.patches.v15_0.remove_sales_partner_from_consolidated_sales_invoice diff --git a/erpnext/patches/v15_0/patch_missing_buying_price_list_in_material_request.py b/erpnext/patches/v15_0/patch_missing_buying_price_list_in_material_request.py new file mode 100644 index 00000000000..48f85335dd2 --- /dev/null +++ b/erpnext/patches/v15_0/patch_missing_buying_price_list_in_material_request.py @@ -0,0 +1,13 @@ +import frappe +import frappe.defaults + + +def execute(): + if frappe.db.has_column("Material Request", "buying_price_list") and ( + default_buying_price_list := frappe.defaults.get_defaults().buying_price_list + ): + docs = frappe.get_all( + "Material Request", filters={"buying_price_list": ["is", "not set"], "docstatus": 1}, pluck="name" + ) + for doc in docs: + frappe.db.set_value("Material Request", doc, "buying_price_list", default_buying_price_list)