Skip to content

Commit

Permalink
refactor: fix failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Sep 26, 2024
1 parent 6a0d4f1 commit 1229f7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 8 additions & 8 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,21 @@ def validate_subscription_details(self):
)

def on_submit(self):
advance_payment_doctypes = frappe.get_hooks("advance_payment_customer_doctypes") + frappe.get_hooks(
"advance_payment_supplier_doctypes"
)
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if self.reference_doctype in advance_payment_doctypes:
# set advance payment status
ref_doc.set_total_advance_paid()

if self.payment_request_type == "Outward":
self.db_set("status", "Initiated")
return
elif self.payment_request_type == "Inward":
self.db_set("status", "Requested")

send_mail = self.payment_gateway_validation() if self.payment_gateway else None
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)

if (
hasattr(ref_doc, "order_type") and ref_doc.order_type == "Shopping Cart"
Expand All @@ -170,13 +177,6 @@ def on_submit(self):
elif self.payment_channel == "Phone":
self.request_phone_payment()

advance_payment_doctypes = frappe.get_hooks("advance_payment_customer_doctypes") + frappe.get_hooks(
"advance_payment_supplier_doctypes"
)
if self.reference_doctype in advance_payment_doctypes:
# set advance payment status
ref_doc.set_total_advance_paid()

def request_phone_payment(self):
controller = _get_payment_gateway_controller(self.payment_gateway)
request_amount = self.get_request_amount()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def on_submit(self):
update_voucher_outstanding(
alloc.reference_doctype, alloc.reference_name, alloc.account, alloc.party_type, alloc.party
)
if doc.doctype in frappe.get_hooks("advance_payment_doctypes"):

advance_payment_doctypes = frappe.get_hooks(
"advance_payment_customer_doctypes"
) + frappe.get_hooks("advance_payment_supplier_doctypes")
if doc.doctype in advance_payment_doctypes:
doc.set_total_advance_paid()

frappe.db.set_value("Unreconcile Payment Entries", alloc.name, "unlinked", True)
Expand Down

0 comments on commit 1229f7b

Please sign in to comment.