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)
This commit is contained in:
David Arnold 2023-11-09 17:34:27 +01:00 committed by GitHub
parent 45b4bfc947
commit 922fffda1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -175,13 +175,6 @@ class PaymentRequest(Document):
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(

View File

@ -338,6 +338,7 @@ erpnext.patches.v15_0.delete_woocommerce_settings_doctype
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

View File

@ -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()