fix: braintree payment processed twice (#27300)

(cherry picked from commit 798b464ee3)

# Conflicts:
#	erpnext/accounts/doctype/payment_request/payment_request.py
#	erpnext/hooks.py
This commit is contained in:
Subin Tom
2021-09-03 12:30:57 +05:30
committed by Mergify
parent f5160dc83d
commit e5eb618a91
2 changed files with 18 additions and 0 deletions

View File

@@ -660,6 +660,7 @@ def make_payment_order(source_name, target_doc=None):
return doclist
<<<<<<< HEAD
def validate_payment(doc, method=None):
if doc.reference_doctype != "Payment Request" or (
@@ -672,3 +673,12 @@ def validate_payment(doc, method=None):
doc.reference_docname
)
)
=======
def validate_payment(doc, method=""):
if not frappe.db.has_column(doc.reference_doctype, 'status'):
return
status = frappe.db.get_value(doc.reference_doctype, doc.reference_docname, 'status')
if status == 'Paid':
frappe.throw(_("The Payment Request {0} is already paid, cannot process payment twice").format(doc.reference_docname))
>>>>>>> 798b464ee3 (fix: braintree payment processed twice (#27300))

View File

@@ -438,6 +438,7 @@ doc_events = {
"validate": ["erpnext.erpnext_integrations.taxjar_integration.set_sales_tax"]
},
"Company": {
<<<<<<< HEAD
"on_trash": [
"erpnext.regional.india.utils.delete_gst_settings_for_company",
"erpnext.regional.saudi_arabia.utils.delete_vat_settings_for_company",
@@ -446,6 +447,13 @@ doc_events = {
"Integration Request": {
"validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
},
=======
"on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company"
},
"Integration Request": {
"validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
}
>>>>>>> 798b464ee3 (fix: braintree payment processed twice (#27300))
}
# On cancel event Payment Entry will be exempted and all linked submittable doctype will get cancelled.