mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 23:22:52 +00:00
[enhancement] request for quotation
This commit is contained in:
@@ -16,6 +16,8 @@ def show_cart_count():
|
||||
return False
|
||||
|
||||
def set_cart_count(login_manager):
|
||||
role, parties = check_customer_or_supplier()
|
||||
if role == 'Supplier': return
|
||||
if show_cart_count():
|
||||
from erpnext.shopping_cart.cart import set_cart_count
|
||||
set_cart_count()
|
||||
@@ -29,6 +31,19 @@ def update_website_context(context):
|
||||
context["shopping_cart_enabled"] = cart_enabled
|
||||
|
||||
def update_my_account_context(context):
|
||||
check_user_role, parties = check_customer_or_supplier()
|
||||
|
||||
if check_user_role == 'Supplier':
|
||||
get_supplier_context(context)
|
||||
else:
|
||||
get_customer_context(context)
|
||||
|
||||
def get_supplier_context(context):
|
||||
context["my_account_list"].extend([
|
||||
{"label": _("Request for Quotations"), "url": "rfq"},
|
||||
])
|
||||
|
||||
def get_customer_context(context):
|
||||
context["my_account_list"].extend([
|
||||
{"label": _("Projects"), "url": "project"},
|
||||
{"label": _("Orders"), "url": "orders"},
|
||||
@@ -37,3 +52,15 @@ def update_my_account_context(context):
|
||||
{"label": _("Issues"), "url": "issues"},
|
||||
{"label": _("Addresses"), "url": "addresses"}
|
||||
])
|
||||
|
||||
def check_customer_or_supplier():
|
||||
if frappe.session.user:
|
||||
contacts = frappe.get_all("Contact", fields=["customer", "supplier", "email_id"],
|
||||
filters={"email_id": frappe.session.user})
|
||||
|
||||
customer = [d.customer for d in contacts if d.customer] or None
|
||||
supplier = [d.supplier for d in contacts if d.supplier] or None
|
||||
|
||||
if customer: return 'Customer', customer
|
||||
if supplier : return 'Supplier', supplier
|
||||
return 'Customer', None
|
||||
Reference in New Issue
Block a user