From 7800db7c0d1af60494968c894b4babde5d471508 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 23 Jan 2023 14:21:10 +0530 Subject: [PATCH] fix: web supplier quotation --- erpnext/templates/pages/order.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py index e1e12bd60d..185ec6615f 100644 --- a/erpnext/templates/pages/order.py +++ b/erpnext/templates/pages/order.py @@ -38,22 +38,27 @@ def get_context(context): if not frappe.has_website_permission(context.doc): frappe.throw(_("Not Permitted"), frappe.PermissionError) - # check for the loyalty program of the customer - customer_loyalty_program = frappe.db.get_value( - "Customer", context.doc.customer, "loyalty_program" - ) - if customer_loyalty_program: - from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( - get_loyalty_program_details_with_points, + context.available_loyalty_points = 0.0 + if context.doc.get("customer"): + # check for the loyalty program of the customer + customer_loyalty_program = frappe.db.get_value( + "Customer", context.doc.customer, "loyalty_program" ) - loyalty_program_details = get_loyalty_program_details_with_points( - context.doc.customer, customer_loyalty_program - ) - context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) + if customer_loyalty_program: + from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( + get_loyalty_program_details_with_points, + ) - # show Make Purchase Invoice button based on permission - context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create") + loyalty_program_details = get_loyalty_program_details_with_points( + context.doc.customer, customer_loyalty_program + ) + context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) + + context.show_make_pi_button = False + if context.doc.get("supplier"): + # show Make Purchase Invoice button based on permission + context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create") def get_attachments(dt, dn):