fix: web supplier quotation

(cherry picked from commit 7800db7c0d)
This commit is contained in:
Rohit Waghchaure
2023-01-23 14:21:10 +05:30
committed by Mergify
parent c928816fc2
commit ceef2d6553

View File

@@ -38,10 +38,13 @@ def get_context(context):
if not frappe.has_website_permission(context.doc): if not frappe.has_website_permission(context.doc):
frappe.throw(_("Not Permitted"), frappe.PermissionError) frappe.throw(_("Not Permitted"), frappe.PermissionError)
context.available_loyalty_points = 0.0
if context.doc.get("customer"):
# check for the loyalty program of the customer # check for the loyalty program of the customer
customer_loyalty_program = frappe.db.get_value( customer_loyalty_program = frappe.db.get_value(
"Customer", context.doc.customer, "loyalty_program" "Customer", context.doc.customer, "loyalty_program"
) )
if customer_loyalty_program: if customer_loyalty_program:
from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
get_loyalty_program_details_with_points, get_loyalty_program_details_with_points,
@@ -52,6 +55,8 @@ def get_context(context):
) )
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) 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 # show Make Purchase Invoice button based on permission
context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create") context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create")