mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 06:45:11 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: add portal user ownership check to supplier quotation (#54298)
This commit is contained in:
@@ -477,6 +477,11 @@ def create_supplier_quotation(doc):
|
||||
if isinstance(doc, str):
|
||||
doc = json.loads(doc)
|
||||
|
||||
if frappe.session.user not in frappe.get_all(
|
||||
"Portal User", {"parent": doc.get("supplier")}, pluck="user"
|
||||
):
|
||||
frappe.throw(_("Not Permitted"), frappe.PermissionError)
|
||||
|
||||
try:
|
||||
sq_doc = frappe.get_doc(
|
||||
{
|
||||
|
||||
@@ -264,6 +264,13 @@ def make_request_for_quotation(**args) -> "RequestforQuotation":
|
||||
|
||||
for data in supplier_data:
|
||||
rfq.append("suppliers", data)
|
||||
frappe.new_doc(
|
||||
"Portal User",
|
||||
user="Administrator",
|
||||
parent=data.get("supplier"),
|
||||
parentfield="portal_users",
|
||||
parenttype="Supplier",
|
||||
).insert()
|
||||
|
||||
rfq.append(
|
||||
"items",
|
||||
|
||||
Reference in New Issue
Block a user