From 922fffda1f4160aeeffdb576c76845f5bbd587dc Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 9 Nov 2023 17:34:27 +0100 Subject: [PATCH] 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) --- .../doctype/payment_request/payment_request.py | 7 ------- erpnext/patches.txt | 1 + .../v15_0/migrate_payment_request_status.py | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 erpnext/patches/v15_0/migrate_payment_request_status.py diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 5f0b434c70..c2e01c4ba3 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -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( diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d394db6d96..0aeadce6c8 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -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 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 0000000000..746a67bced --- /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()