Merge pull request #33790 from rohitwaghchaure/fix-web-supplier-quotation-from-rfq

fix: web supplier quotation
This commit is contained in:
rohitwaghchaure 2023-01-24 15:59:04 +05:30 committed by GitHub
commit a5478c61af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,22 +38,27 @@ 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)
# check for the loyalty program of the customer context.available_loyalty_points = 0.0
customer_loyalty_program = frappe.db.get_value( if context.doc.get("customer"):
"Customer", context.doc.customer, "loyalty_program" # check for the loyalty program of the customer
) customer_loyalty_program = frappe.db.get_value(
if customer_loyalty_program: "Customer", context.doc.customer, "loyalty_program"
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
get_loyalty_program_details_with_points,
) )
loyalty_program_details = get_loyalty_program_details_with_points( if customer_loyalty_program:
context.doc.customer, customer_loyalty_program from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
) get_loyalty_program_details_with_points,
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) )
# show Make Purchase Invoice button based on permission loyalty_program_details = get_loyalty_program_details_with_points(
context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create") 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): def get_attachments(dt, dn):