fix: multicurrency on course cards
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
# Copyright (c) 2022, Frappe and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class BatchStudent(Document):
|
||||
pass
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def enroll_batch(batch_name):
|
||||
enrollment = frappe.new_doc("Batch Student")
|
||||
enrollment.student = frappe.session.user
|
||||
enrollment.parent = batch_name
|
||||
enrollment.parentfield = "students"
|
||||
enrollment.parenttype = "LMS Batch"
|
||||
enrollment.save(ignore_permissions=True)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"start_time",
|
||||
"end_time",
|
||||
"published",
|
||||
"allow_self_enrollment",
|
||||
"section_break_rgfj",
|
||||
"medium",
|
||||
"category",
|
||||
@@ -293,11 +294,17 @@
|
||||
"fieldname": "amount_usd",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount (USD)"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "allow_self_enrollment",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Self Enrollment"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-01-08 09:58:23.212334",
|
||||
"modified": "2024-01-22 10:42:42.872995",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Batch",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"event": "Days Before",
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course ${0} has been scheduled on ${1} at ${2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
|
||||
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
|
||||
"message_type": "HTML",
|
||||
"modified": "2023-11-29 17:26:53.355501",
|
||||
"modified_by": "Administrator",
|
||||
@@ -29,4 +29,4 @@
|
||||
"send_system_notification": 0,
|
||||
"send_to_all_assignees": 0,
|
||||
"subject": "Reminder for Certificate Evaluation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1194,6 +1194,7 @@ def get_course_details(course):
|
||||
"paid_course",
|
||||
"course_price",
|
||||
"currency",
|
||||
"amount_usd",
|
||||
],
|
||||
as_dict=1,
|
||||
)
|
||||
@@ -1214,6 +1215,9 @@ def get_course_details(course):
|
||||
|
||||
course_details.instructors = get_instructors(course_details.name)
|
||||
if course_details.paid_course:
|
||||
course_details.course_price, course_details.currency = check_multicurrency(
|
||||
course_details.course_price, course_details.currency, None, course_details.amount_usd
|
||||
)
|
||||
course_details.price = fmt_money(
|
||||
course_details.course_price, 0, course_details.currency
|
||||
)
|
||||
@@ -1385,9 +1389,11 @@ def get_batch_details(batch):
|
||||
"seat_count",
|
||||
"published",
|
||||
"amount",
|
||||
"amount_usd",
|
||||
"currency",
|
||||
"paid_batch",
|
||||
"evaluation_end_date",
|
||||
"allow_self_enrollment",
|
||||
],
|
||||
as_dict=True,
|
||||
)
|
||||
@@ -1398,7 +1404,11 @@ def get_batch_details(batch):
|
||||
batch_details.students = frappe.get_all(
|
||||
"Batch Student", {"parent": batch}, pluck="student"
|
||||
)
|
||||
batch_details.price = fmt_money(batch_details.amount, 0, batch_details.currency)
|
||||
if batch_details.paid_batch:
|
||||
batch_details.amount, batch_details.currency = check_multicurrency(
|
||||
batch_details.amount, batch_details.currency, None, batch_details.amount_usd
|
||||
)
|
||||
batch_details.price = fmt_money(batch_details.amount, 0, batch_details.currency)
|
||||
|
||||
if batch_details.seat_count:
|
||||
students_enrolled = frappe.db.count(
|
||||
|
||||
Reference in New Issue
Block a user