fix: only show pay button for specific doctype in portal

This commit is contained in:
ljain112
2024-10-22 19:49:37 +05:30
parent 29fe23bc0a
commit d2e5b2aa1d
2 changed files with 20 additions and 2 deletions

View File

@@ -4,6 +4,10 @@
import frappe
from frappe import _
from erpnext.accounts.doctype.payment_request.payment_request import (
ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST,
)
def get_context(context):
context.no_cache = 1
@@ -46,8 +50,10 @@ def get_context(context):
)
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
context.show_pay_button = "payments" in frappe.get_installed_apps() and frappe.db.get_single_value(
"Buying Settings", "show_pay_button"
context.show_pay_button = (
"payments" in frappe.get_installed_apps()
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
and context.doc.doctype in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST
)
context.show_make_pi_button = False
if context.doc.get("supplier"):