fix: batch creation error
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
|
"autoname": "format: BATCH-{#####}",
|
||||||
"creation": "2021-03-18 19:37:34.614796",
|
"creation": "2021-03-18 19:37:34.614796",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -28,12 +29,14 @@
|
|||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Course",
|
"label": "Course",
|
||||||
"options": "LMS Course"
|
"options": "LMS Course",
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "title",
|
"fieldname": "title",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Title"
|
"label": "Title",
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
@@ -119,10 +122,11 @@
|
|||||||
"link_fieldname": "batch"
|
"link_fieldname": "batch"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-06-16 10:51:05.403726",
|
"modified": "2022-09-28 18:43:22.955907",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Batch",
|
"name": "LMS Batch",
|
||||||
|
"naming_rule": "Expression",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
@@ -141,5 +145,6 @@
|
|||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
@@ -11,11 +11,13 @@ from lms.lms.utils import is_mentor
|
|||||||
|
|
||||||
class LMSBatch(Document):
|
class LMSBatch(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_if_mentor()
|
pass
|
||||||
|
#self.validate_if_mentor()
|
||||||
|
|
||||||
def validate_if_mentor(self):
|
def validate_if_mentor(self):
|
||||||
if not is_mentor(self.course, frappe.session.user):
|
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):
|
def after_insert(self):
|
||||||
create_membership(batch=self.name, course=self.course, member_type="Mentor")
|
create_membership(batch=self.name, course=self.course, member_type="Mentor")
|
||||||
|
|||||||
Reference in New Issue
Block a user