fix: only show pay button for specific doctype in portal

This commit is contained in:
ljain112
2024-10-21 13:53:40 +05:30
parent ee8cae11ee
commit fc2cac62c1
2 changed files with 17 additions and 9 deletions

View File

@@ -4,7 +4,10 @@
import frappe
from frappe import _
from erpnext.accounts.doctype.payment_request.payment_request import get_amount
from erpnext.accounts.doctype.payment_request.payment_request import (
ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST,
get_amount,
)
def get_context(context):
@@ -68,10 +71,12 @@ def get_payment_details(doc):
(
"payments" in frappe.get_installed_apps()
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
and doc.doctype in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST
),
0,
)
if not show_pay_button:
return show_pay_button, amount
amount = get_amount(doc)
return bool(amount), amount