Validate if already exist

I need click on the button “orçamento” and before run some function, check if has a quotation with the os field equal of the table form, in this case “OS-MV00020/0”.

e.g. logic:
variable = frappe.get_doc(“Quotation”, “OS-MV00020/0”)
if variable == null, run a function
else alert(“there is already a doc”)

1 Like