fix: added server side validation for submit on creation
This commit is contained in:
parent
30fbf37f25
commit
ec0d1dd63f
1 changed files with 6 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ class AutoRepeat(Document):
|
|||
def validate(self):
|
||||
self.update_status()
|
||||
self.validate_reference_doctype()
|
||||
self.validate_submit_on_creation()
|
||||
self.validate_dates()
|
||||
self.validate_email_id()
|
||||
self.set_dates()
|
||||
|
|
@ -60,6 +61,11 @@ class AutoRepeat(Document):
|
|||
if not frappe.get_meta(self.reference_doctype).allow_auto_repeat:
|
||||
frappe.throw(_("Enable Allow Auto Repeat for the doctype {0} in Customize Form").format(self.reference_doctype))
|
||||
|
||||
def validate_submit_on_creation(self):
|
||||
if self.submit_on_creation and not frappe.get_meta(self.reference_doctype).is_submittable:
|
||||
frappe.throw(_('Cannot enable {0} for a non-submittable doctype').format(
|
||||
frappe.bold('Submit on Creation')))
|
||||
|
||||
def validate_dates(self):
|
||||
if frappe.flags.in_patch:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue