From 1e66742d02c988d62f5a51311df3f1bdf396f5af Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 28 Sep 2022 21:55:35 +0530 Subject: [PATCH] fix: batch creation error --- lms/lms/doctype/lms_batch/lms_batch.json | 11 ++++++++--- lms/lms/doctype/lms_batch/lms_batch.py | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lms/lms/doctype/lms_batch/lms_batch.json b/lms/lms/doctype/lms_batch/lms_batch.json index 257def0a..8d165435 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.json +++ b/lms/lms/doctype/lms_batch/lms_batch.json @@ -1,5 +1,6 @@ { "actions": [], + "autoname": "format: BATCH-{#####}", "creation": "2021-03-18 19:37:34.614796", "doctype": "DocType", "editable_grid": 1, @@ -28,12 +29,14 @@ "in_list_view": 1, "in_standard_filter": 1, "label": "Course", - "options": "LMS Course" + "options": "LMS Course", + "reqd": 1 }, { "fieldname": "title", "fieldtype": "Data", - "label": "Title" + "label": "Title", + "reqd": 1 }, { "fieldname": "description", @@ -119,10 +122,11 @@ "link_fieldname": "batch" } ], - "modified": "2021-06-16 10:51:05.403726", + "modified": "2022-09-28 18:43:22.955907", "modified_by": "Administrator", "module": "LMS", "name": "LMS Batch", + "naming_rule": "Expression", "owner": "Administrator", "permissions": [ { @@ -141,5 +145,6 @@ "quick_entry": 1, "sort_field": "modified", "sort_order": "DESC", + "states": [], "track_changes": 1 } \ No newline at end of file diff --git a/lms/lms/doctype/lms_batch/lms_batch.py b/lms/lms/doctype/lms_batch/lms_batch.py index 22bbd2e8..d360f5be 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -11,11 +11,13 @@ from lms.lms.utils import is_mentor class LMSBatch(Document): def validate(self): - self.validate_if_mentor() + pass + #self.validate_if_mentor() def validate_if_mentor(self): if not is_mentor(self.course, frappe.session.user): - frappe.throw(_("You are not a mentor of the course {0}").format(course.title)) + course_title = frappe.db.get_value("LMS Course", self.course, "title") + frappe.throw(_("You are not a mentor of the course {0}").format(course_title)) def after_insert(self): create_membership(batch=self.name, course=self.course, member_type="Mentor")