fix(payments): incoming payment requests aren't supposed to be in 'initiated' state (only outgoing are) (#37447)

* fix(payments): incoming payment requests aren't supposed to be in 'initiated' state (only outgoing are)

* fixup! fix(payments): incoming payment requests aren't supposed to be in 'initiated' state (only outgoing are)
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 5f0b434..c2e01c4 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -175,13 +175,6 @@
 		if self.payment_url:
 			self.db_set("payment_url", self.payment_url)
 
-		if (
-			self.payment_url
-			or not self.payment_gateway_account
-			or (self.payment_gateway_account and self.payment_channel == "Phone")
-		):
-			self.db_set("status", "Initiated")
-
 	def get_payment_url(self):
 		if self.reference_doctype != "Fees":
 			data = frappe.db.get_value(
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d394db6..0aeadce 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -338,6 +338,7 @@
 erpnext.patches.v14_0.migrate_deferred_accounts_to_item_defaults
 erpnext.patches.v14_0.update_invoicing_period_in_subscription
 execute:frappe.delete_doc("Page", "welcome-to-erpnext")
+erpnext.patches.v15_0.migrate_payment_request_status
 erpnext.patches.v15_0.delete_payment_gateway_doctypes
 erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item
 erpnext.patches.v15_0.update_sre_from_voucher_details
diff --git a/erpnext/patches/v15_0/migrate_payment_request_status.py b/erpnext/patches/v15_0/migrate_payment_request_status.py
new file mode 100644
index 0000000..746a67b
--- /dev/null
+++ b/erpnext/patches/v15_0/migrate_payment_request_status.py
@@ -0,0 +1,15 @@
+import frappe
+
+
+def execute():
+	"""
+	Description:
+	Change Inward Payment Requests from statut 'Initiated' to correct status 'Requested'.
+	Status 'Initiated' is reserved for Outward Payment Requests and was a semantic error in previour versions.
+	"""
+
+	if frappe.reload_doc("accounts", "doctype", "Payment Request"):
+		so = frappe.qb.DocType("Payment Request")
+		frappe.qb.update(so).set(so.status, "Requested").where(
+			so.payment_request_type == "Inward"
+		).where(so.status == "Initiated").run()