diff --git a/frontend/src/pages/CourseForm.vue b/frontend/src/pages/CourseForm.vue index 39136d7b..20e0bba8 100644 --- a/frontend/src/pages/CourseForm.vue +++ b/frontend/src/pages/CourseForm.vue @@ -271,13 +271,21 @@ " /> - +
+ + +
@@ -388,6 +396,7 @@ const course = reactive({ course_price: '', currency: '', evaluator: '', + timezone: '', }) const meta = reactive({ diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json index ae59baf1..311d8d8b 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json @@ -133,7 +133,6 @@ "read_only": 1 }, { - "fetch_from": "batch_name.timezone", "fieldname": "timezone", "fieldtype": "Data", "label": "Timezone", @@ -155,10 +154,11 @@ "read_only": 1 } ], + "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-02-19 17:20:02.526294", - "modified_by": "Administrator", + "modified": "2025-10-13 14:30:57.897102", + "modified_by": "sayali@frappe.io", "module": "LMS", "name": "LMS Certificate Request", "owner": "Administrator", @@ -211,6 +211,7 @@ "write": 1 } ], + "row_format": "Dynamic", "sort_field": "modified", "sort_order": "DESC", "states": [ @@ -228,4 +229,4 @@ } ], "title_field": "member_name" -} \ No newline at end of file +} diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py index 3d3f41fe..75d65028 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py @@ -28,6 +28,7 @@ class LMSCertificateRequest(Document): self.validate_slot() self.validate_if_existing_requests() self.validate_evaluation_end_date() + self.validate_timezone() def after_insert(self): self.send_notification() @@ -113,6 +114,20 @@ class LMSCertificateRequest(Document): ) ) + def validate_timezone(self): + if self.timezone: + return + if self.batch_name: + timezone = frappe.db.get_value("LMS Batch", self.batch_name, "timezone") + if timezone: + self.timezone = timezone + return + if self.course: + timezone = frappe.db.get_value("LMS Course", self.course, "timezone") + if timezone: + self.timezone = timezone + return + def send_notification(self): outgoing_email_account = frappe.get_cached_value( "Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name" diff --git a/lms/lms/doctype/lms_course/lms_course.json b/lms/lms/doctype/lms_course/lms_course.json index fdc11da2..20fc0482 100644 --- a/lms/lms/doctype/lms_course/lms_course.json +++ b/lms/lms/doctype/lms_course/lms_course.json @@ -43,11 +43,14 @@ "paid_course", "enable_certification", "paid_certificate", - "evaluator", "column_break_acoj", + "section_break_vqbh", "course_price", "currency", "amount_usd", + "column_break_sflq", + "evaluator", + "timezone", "tab_4_tab", "statistics_section", "enrollments", @@ -278,6 +281,20 @@ "fieldtype": "Select", "label": "Color", "options": "Red\nBlue\nGreen\nAmber\nCyan\nOrange\nPink\nPurple\nTeal\nViolet\nYellow\nGray" + }, + { + "fieldname": "section_break_vqbh", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_sflq", + "fieldtype": "Column Break" + }, + { + "depends_on": "paid_certificate", + "fieldname": "timezone", + "fieldtype": "Data", + "label": "Timezone" } ], "is_published_field": "published", @@ -296,7 +313,7 @@ } ], "make_attachments_public": 1, - "modified": "2025-07-25 17:50:44.983391", + "modified": "2025-10-13 15:08:11.734204", "modified_by": "sayali@frappe.io", "module": "LMS", "name": "LMS Course", diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index ddf3688d..85e6dbdf 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -68,6 +68,9 @@ class LMSCourse(Document): if self.paid_certificate and not self.evaluator: frappe.throw(_("Evaluator is required for paid certificates.")) + if self.paid_certificate and not self.timezone: + frappe.throw(_("Timezone is required for paid certificates.")) + def validate_amount_and_currency(self): if self.paid_course and (cint(self.course_price) < 0 or not self.currency): frappe.throw(_("Amount and currency are required for paid courses."))