feat: batch source
This commit is contained in:
@@ -9,11 +9,12 @@
|
||||
"field_order": [
|
||||
"student_details_section",
|
||||
"student",
|
||||
"payment",
|
||||
"confirmation_email_sent",
|
||||
"column_break_oduu",
|
||||
"student_name",
|
||||
"username"
|
||||
"username",
|
||||
"column_break_oduu",
|
||||
"payment",
|
||||
"source",
|
||||
"confirmation_email_sent"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -59,12 +60,18 @@
|
||||
"fieldname": "confirmation_email_sent",
|
||||
"fieldtype": "Check",
|
||||
"label": "Confirmation Email Sent"
|
||||
},
|
||||
{
|
||||
"fieldname": "source",
|
||||
"fieldtype": "Link",
|
||||
"label": "Source",
|
||||
"options": "LMS Source"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-10-09 17:09:50.481794",
|
||||
"modified": "2023-10-26 16:52:04.266693",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Batch Student",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"field_order": [
|
||||
"payment_for_document_type",
|
||||
"member",
|
||||
"source",
|
||||
"column_break_rqkd",
|
||||
"payment_for_document",
|
||||
"billing_name",
|
||||
@@ -129,11 +130,17 @@
|
||||
"fieldtype": "Dynamic Link",
|
||||
"label": "Payment for Document",
|
||||
"options": "payment_for_document_type"
|
||||
},
|
||||
{
|
||||
"fieldname": "source",
|
||||
"fieldtype": "Link",
|
||||
"label": "Source",
|
||||
"options": "LMS Source"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-10-17 23:17:50.334975",
|
||||
"modified": "2023-10-26 16:54:12.408274",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Payment",
|
||||
|
||||
0
lms/lms/doctype/lms_source/__init__.py
Normal file
0
lms/lms/doctype/lms_source/__init__.py
Normal file
8
lms/lms/doctype/lms_source/lms_source.js
Normal file
8
lms/lms/doctype/lms_source/lms_source.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2023, Frappe and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("LMS Source", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
69
lms/lms/doctype/lms_source/lms_source.json
Normal file
69
lms/lms/doctype/lms_source/lms_source.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:source",
|
||||
"creation": "2023-10-26 16:28:53.932278",
|
||||
"default_view": "List",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"source"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "source",
|
||||
"fieldtype": "Data",
|
||||
"label": "Source",
|
||||
"unique": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-10-26 17:25:09.144367",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Source",
|
||||
"naming_rule": "By fieldname",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Moderator",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "LMS Student",
|
||||
"select": 1,
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"title_field": "source"
|
||||
}
|
||||
9
lms/lms/doctype/lms_source/lms_source.py
Normal file
9
lms/lms/doctype/lms_source/lms_source.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2023, Frappe and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class LMSSource(Document):
|
||||
pass
|
||||
9
lms/lms/doctype/lms_source/test_lms_source.py
Normal file
9
lms/lms/doctype/lms_source/test_lms_source.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2023, Frappe and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestLMSSource(FrappeTestCase):
|
||||
pass
|
||||
@@ -898,7 +898,7 @@ def check_multicurrency(amount, currency, country=None):
|
||||
currency = "USD"
|
||||
|
||||
if apply_rounding and amount % 100 != 0:
|
||||
amount = ceil(amount + 100 - amount % 100)
|
||||
amount = amount + 100 - amount % 100
|
||||
|
||||
return amount, currency
|
||||
|
||||
@@ -1028,12 +1028,13 @@ def record_payment(address, response, client, doctype, docname):
|
||||
"amount_with_gst": payment_details["amount_with_gst"],
|
||||
"gstin": address.gstin,
|
||||
"pan": address.pan,
|
||||
"source": address.source,
|
||||
"payment_for_document_type": doctype,
|
||||
"payment_for_document": docname,
|
||||
}
|
||||
)
|
||||
payment_doc.save(ignore_permissions=True)
|
||||
return payment_doc.name
|
||||
return payment_doc
|
||||
|
||||
|
||||
def get_payment_details(doctype, docname, address):
|
||||
@@ -1056,7 +1057,7 @@ def get_payment_details(doctype, docname, address):
|
||||
def create_membership(course, payment):
|
||||
membership = frappe.new_doc("LMS Enrollment")
|
||||
membership.update(
|
||||
{"member": frappe.session.user, "course": course, "payment": payment}
|
||||
{"member": frappe.session.user, "course": course, "payment": payment.name}
|
||||
)
|
||||
membership.save(ignore_permissions=True)
|
||||
return f"/courses/{course}/learn/1.1"
|
||||
@@ -1067,7 +1068,8 @@ def add_student_to_batch(batchname, payment):
|
||||
student.update(
|
||||
{
|
||||
"student": frappe.session.user,
|
||||
"payment": payment,
|
||||
"payment": payment.name,
|
||||
"source": payment.source,
|
||||
"parent": batchname,
|
||||
"parenttype": "LMS Batch",
|
||||
"parentfield": "students",
|
||||
|
||||
Reference in New Issue
Block a user