Skip to content

Commit

Permalink
fix(payments): incoming payment requests aren't supposed to be in 'in…
Browse files Browse the repository at this point in the history
…itiated' 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)
  • Loading branch information
blaggacao authored Nov 9, 2023
1 parent 45b4bfc commit 922fffd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 0 additions & 7 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,6 @@ def set_payment_request_url(self):
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(
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions erpnext/patches/v15_0/migrate_payment_request_status.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 922fffd

Please sign in to comment.