fix: batch course sequence id issue

This commit is contained in:
Jannat Patel
2023-09-14 12:34:34 +05:30
parent 9c00a5561a
commit 29860583f4
4 changed files with 13 additions and 1 deletions

View File

@@ -245,6 +245,10 @@ def fetch_lessons(courses):
@frappe.whitelist()
def add_course(course, parent, name=None, evaluator=None):
frappe.only_for("Moderator")
if frappe.db.exists("Batch Course", {"course": course, "parent": parent}):
frappe.throw(_("Course already added to the batch."))
if name:
doc = frappe.get_doc("Batch Course", name)
else:

View File

@@ -68,4 +68,5 @@ lms.patches.v1_0.rename_lms_batch_membership_doctype
lms.patches.v1_0.rename_lms_class_to_lms_batch
lms.patches.v1_0.rename_classes_in_navbar
lms.patches.v1_0.publish_batches
lms.patches.v1_0.publish_certificates
lms.patches.v1_0.publish_certificates
lms.patches.v1_0.change_naming_for_batch_course #14-09-2023

View File

@@ -0,0 +1,6 @@
import frappe
def execute():
frappe.db.create_sequence("Batch Course", check_not_exists=True)
frappe.db.set_next_sequence_val("Batch Course", 500, is_val_used=False)

View File

@@ -31,6 +31,7 @@ const show_course_modal = (e) => {
reqd: 1,
only_select: 1,
default: course || "",
read_only: course ? 1 : 0,
},
{
fieldtype: "Link",