fix: allow all users of supplier to create purchase invoices

(cherry picked from commit 190204a939)
This commit is contained in:
Mihir Kandoi
2026-01-08 13:14:34 +05:30
committed by Mergify
parent a7f59fece3
commit 8f1509dca1

View File

@@ -794,7 +794,7 @@ def make_purchase_invoice(source_name, target_doc=None, args=None):
@frappe.whitelist()
def make_purchase_invoice_from_portal(purchase_order_name):
doc = get_mapped_purchase_invoice(purchase_order_name, ignore_permissions=True)
if doc.contact_email != frappe.session.user:
if frappe.session.user not in frappe.get_all("Portal User", {"parent": doc.supplier}, pluck="user"):
frappe.throw(_("Not Permitted"), frappe.PermissionError)
doc.save()
frappe.db.commit()