Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/src/pages/Batches/components/NewBatchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ import { Button, Dialog, FormControl, TextEditor, toast } from 'frappe-ui'
import { useOnboarding, useTelemetry } from 'frappe-ui/frappe'
import { computed, inject, onMounted, onBeforeUnmount, ref } from 'vue'
import { useRouter } from 'vue-router'
import { sanitizeHTML, createLMSCategory } from '@/utils'
import { sanitizeHTML, createLMSCategory, cleanError } from '@/utils'
import MultiSelect from '@/components/Controls/MultiSelect.vue'
import Link from '@/components/Controls/Link.vue'
import NewMemberModal from '@/components/Modals/NewMemberModal.vue'
Expand Down Expand Up @@ -214,7 +214,8 @@ const saveBatch = (close: () => void = () => {}) => {
}
},
onError(err: any) {
toast.error(cleanError(err.messages?.[0]))
const message = err?.messages?.[0]
toast.error(message ? cleanError(message) : __('Error creating batch'))
console.error(err)
},
}
Expand Down
3 changes: 2 additions & 1 deletion lms/lms/doctype/lms_batch/lms_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class LMSBatch(Document):
def validate(self):
self._validate_mandatory()
self.validate_seats_left()
self.validate_batch_end_date()
self.validate_batch_time()
Expand All @@ -43,7 +44,7 @@ def on_update(self):
frappe.enqueue(send_notification_for_published_batch, batch=self)

def autoname(self):
if not self.name:
if not self.name and self.title:
self.name = generate_slug(self.title, "LMS Batch")

def validate_batch_end_date(self):
Expand Down
Loading