fix: billing flow
This commit is contained in:
@@ -12,7 +12,12 @@ frappe.ui.form.on("LMS Batch", {
|
||||
});
|
||||
|
||||
frm.set_query("reference_doctype", "timetable", function () {
|
||||
let doctypes = ["Course Lesson", "LMS Quiz", "LMS Assignment"];
|
||||
let doctypes = [
|
||||
"Course Lesson",
|
||||
"LMS Quiz",
|
||||
"LMS Assignment",
|
||||
"LMS Live Class",
|
||||
];
|
||||
return {
|
||||
filters: {
|
||||
name: ["in", doctypes],
|
||||
|
||||
@@ -146,8 +146,9 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "category",
|
||||
"fieldtype": "Autocomplete",
|
||||
"label": "Category"
|
||||
"fieldtype": "Link",
|
||||
"label": "Category",
|
||||
"options": "LMS Category"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ubxi",
|
||||
@@ -221,7 +222,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-09-20 11:25:10.683688",
|
||||
"modified": "2023-09-20 14:40:45.940540",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Batch",
|
||||
|
||||
@@ -320,6 +320,7 @@ const open_batch_dialog = () => {
|
||||
label: __("Category"),
|
||||
fieldname: "category",
|
||||
options: "LMS Category",
|
||||
only_select: 1,
|
||||
default: batch_info && batch_info.category,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from lms.lms.utils import has_course_moderator_role, has_course_evaluator_role
|
||||
from lms.lms.utils import (
|
||||
has_course_moderator_role,
|
||||
has_course_evaluator_role,
|
||||
check_multicurrency,
|
||||
)
|
||||
from lms.www.utils import is_student
|
||||
|
||||
|
||||
@@ -29,6 +33,13 @@ def get_context(context):
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
if context.batch_info.amount and context.batch_info.currency:
|
||||
amount, currency = check_multicurrency(
|
||||
context.batch_info.amount, context.batch_info.currency
|
||||
)
|
||||
context.batch_info.amount = amount
|
||||
context.batch_info.currency = currency
|
||||
|
||||
context.is_moderator = has_course_moderator_role()
|
||||
context.is_evaluator = has_course_evaluator_role()
|
||||
context.is_student = is_student(batch_name)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import frappe
|
||||
from frappe.utils import getdate
|
||||
from lms.lms.utils import has_course_moderator_role, has_course_evaluator_role
|
||||
from lms.lms.utils import (
|
||||
has_course_moderator_role,
|
||||
has_course_evaluator_role,
|
||||
check_multicurrency,
|
||||
)
|
||||
|
||||
|
||||
def get_context(context):
|
||||
@@ -28,6 +32,12 @@ def get_context(context):
|
||||
for batch in batches:
|
||||
batch.student_count = frappe.db.count("Batch Student", {"parent": batch.name})
|
||||
batch.course_count = frappe.db.count("Batch Course", {"parent": batch.name})
|
||||
|
||||
if batch.amount and batch.currency:
|
||||
amount, currency = check_multicurrency(batch.amount, batch.currency)
|
||||
batch.amount = amount
|
||||
batch.currency = currency
|
||||
|
||||
batch.seats_left = (
|
||||
batch.seat_count - batch.student_count if batch.seat_count else None
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user