Merge pull request #36551 from barredterra/fix-rfq-link
fix(RFQ): link to supplier portal
This commit is contained in:
commit
c1dd06065b
@ -116,7 +116,10 @@ class RequestforQuotation(BuyingController):
|
|||||||
route = frappe.db.get_value(
|
route = frappe.db.get_value(
|
||||||
"Portal Menu Item", {"reference_doctype": "Request for Quotation"}, ["route"]
|
"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):
|
def update_supplier_part_no(self, supplier):
|
||||||
self.vendor = supplier
|
self.vendor = supplier
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
# See license.txt
|
# See license.txt
|
||||||
|
|
||||||
|
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.tests.utils import FrappeTestCase
|
from frappe.tests.utils import FrappeTestCase
|
||||||
from frappe.utils import nowdate
|
from frappe.utils import nowdate
|
||||||
|
|
||||||
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
|
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
|
||||||
|
RequestforQuotation,
|
||||||
create_supplier_quotation,
|
create_supplier_quotation,
|
||||||
get_pdf,
|
get_pdf,
|
||||||
make_supplier_quotation_from_rfq,
|
make_supplier_quotation_from_rfq,
|
||||||
@ -125,13 +128,18 @@ class TestRequestforQuotation(FrappeTestCase):
|
|||||||
rfq.status = "Draft"
|
rfq.status = "Draft"
|
||||||
rfq.submit()
|
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):
|
def test_get_pdf(self):
|
||||||
rfq = make_request_for_quotation()
|
rfq = make_request_for_quotation()
|
||||||
get_pdf(rfq.name, rfq.get("suppliers")[0].supplier)
|
get_pdf(rfq.name, rfq.get("suppliers")[0].supplier)
|
||||||
self.assertEqual(frappe.local.response.type, "pdf")
|
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
|
:param supplier_data: List containing supplier data
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user