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 () {
|
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 {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
name: ["in", doctypes],
|
name: ["in", doctypes],
|
||||||
|
|||||||
@@ -146,8 +146,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "category",
|
"fieldname": "category",
|
||||||
"fieldtype": "Autocomplete",
|
"fieldtype": "Link",
|
||||||
"label": "Category"
|
"label": "Category",
|
||||||
|
"options": "LMS Category"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_ubxi",
|
"fieldname": "section_break_ubxi",
|
||||||
@@ -221,7 +222,7 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-09-20 11:25:10.683688",
|
"modified": "2023-09-20 14:40:45.940540",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Batch",
|
"name": "LMS Batch",
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ const open_batch_dialog = () => {
|
|||||||
label: __("Category"),
|
label: __("Category"),
|
||||||
fieldname: "category",
|
fieldname: "category",
|
||||||
options: "LMS Category",
|
options: "LMS Category",
|
||||||
|
only_select: 1,
|
||||||
default: batch_info && batch_info.category,
|
default: batch_info && batch_info.category,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
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
|
from lms.www.utils import is_student
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +33,13 @@ def get_context(context):
|
|||||||
as_dict=1,
|
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_moderator = has_course_moderator_role()
|
||||||
context.is_evaluator = has_course_evaluator_role()
|
context.is_evaluator = has_course_evaluator_role()
|
||||||
context.is_student = is_student(batch_name)
|
context.is_student = is_student(batch_name)
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import getdate
|
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):
|
def get_context(context):
|
||||||
@@ -28,6 +32,12 @@ def get_context(context):
|
|||||||
for batch in batches:
|
for batch in batches:
|
||||||
batch.student_count = frappe.db.count("Batch Student", {"parent": batch.name})
|
batch.student_count = frappe.db.count("Batch Student", {"parent": batch.name})
|
||||||
batch.course_count = frappe.db.count("Batch Course", {"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.seats_left = (
|
||||||
batch.seat_count - batch.student_count if batch.seat_count else None
|
batch.seat_count - batch.student_count if batch.seat_count else None
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user