fix: add portal user ownership check to supplier quotation (#54298)

This commit is contained in:
Mihir Kandoi
2026-04-15 11:21:08 +05:30
committed by GitHub
parent 0969ec4186
commit af6974893b
2 changed files with 12 additions and 0 deletions

View File

@@ -481,6 +481,11 @@ def create_supplier_quotation(doc: str | Document | dict):
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(
{

View File

@@ -263,6 +263,13 @@ def make_request_for_quotation(**args):
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",