fix: hide Submit button on non-submittable doctypes (#36825)

can_submit() only checked docstatus, permissions, and workflow
but never verified the doctype is actually submittable. Since all
documents start at docstatus 0, this caused a Submit button to
appear on any non-submittable doctype where the user has submit
permission (e.g. System Manager).
This commit is contained in:
Luis Mendoza 2026-02-07 03:15:17 -03:00 committed by GitHub
parent 25df73931b
commit b408bc92c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -670,6 +670,7 @@ frappe.ui.form.Toolbar = class Toolbar {
}
can_submit() {
return (
frappe.model.is_submittable(this.frm.doc.doctype) &&
this.get_docstatus() === 0 &&
!this.frm.doc.__islocal &&
!this.frm.doc.__unsaved &&