Disable supplier- Purchase order permission

Hello,

I have used following server script that, purchase orders should not be placed with disable suppliers, but it is throwing a error

And also , how to set permissions if at all we have to use disable suppliers for placing purchase orders?

thanks in advance

You can’t use the import and add library or method.

Please add the logic in a simple way.

Please remove the 1 to 5 line and set the indentation code of the 6 to 10 line.

can u pls send me , am getting error pls

follow this.

supplier_status = frappe.db.get_value("Supplier", doc.supplier, "disabled")
if supplier_status:
	frappe.throw(f"Supplier <b>{doc.supplier}</b> is inactive and can't be use for Purchase Order.")

Hi @NCP : thanks

If at all we have to use the disable supplier for creating purchase order, how do we set permissions at the user level?

Prasad