Merge pull request #36551 from barredterra/fix-rfq-link

fix(RFQ): link to supplier portal
This commit is contained in:
s-aga-r 2023-08-08 16:55:02 +05:30 committed by GitHub
commit c1dd06065b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -116,7 +116,10 @@ class RequestforQuotation(BuyingController):
route = frappe.db.get_value(
"Portal Menu Item", {"reference_doctype": "Request for Quotation"}, ["route"]
)
return get_url("/app/{0}/".format(route) + self.name)
if not route:
frappe.throw(_("Please add Request for Quotation to the sidebar in Portal Settings."))
return get_url(f"{route}/{self.name}")
def update_supplier_part_no(self, supplier):
self.vendor = supplier

View File

@ -2,11 +2,14 @@
# See license.txt
from urllib.parse import urlparse
import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils import nowdate
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
RequestforQuotation,
create_supplier_quotation,
get_pdf,
make_supplier_quotation_from_rfq,
@ -125,13 +128,18 @@ class TestRequestforQuotation(FrappeTestCase):
rfq.status = "Draft"
rfq.submit()
def test_get_link(self):
rfq = make_request_for_quotation()
parsed_link = urlparse(rfq.get_link())
self.assertEqual(parsed_link.path, f"/rfq/{rfq.name}")
def test_get_pdf(self):
rfq = make_request_for_quotation()
get_pdf(rfq.name, rfq.get("suppliers")[0].supplier)
self.assertEqual(frappe.local.response.type, "pdf")
def make_request_for_quotation(**args):
def make_request_for_quotation(**args) -> "RequestforQuotation":
"""
:param supplier_data: List containing supplier data
"""