feat: certificate template
This commit is contained in:
@@ -10,6 +10,14 @@ frappe.ui.form.on("LMS Certificate", {
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("template", function (doc) {
|
||||
return {
|
||||
filters: {
|
||||
doc_type: "LMS Certificate",
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
refresh: (frm) => {
|
||||
if (frm.doc.name)
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
"course",
|
||||
"member",
|
||||
"member_name",
|
||||
"published",
|
||||
"template",
|
||||
"column_break_3",
|
||||
"issue_date",
|
||||
"expiry_date",
|
||||
"batch_name"
|
||||
"batch_name",
|
||||
"published"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -67,11 +68,18 @@
|
||||
"fieldname": "published",
|
||||
"fieldtype": "Check",
|
||||
"label": "Publish on Participant Page"
|
||||
},
|
||||
{
|
||||
"fieldname": "template",
|
||||
"fieldtype": "Link",
|
||||
"label": "Template",
|
||||
"options": "Print Format",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-09-13 11:03:23.479255",
|
||||
"modified": "2023-10-25 12:20:56.091979",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Certificate",
|
||||
|
||||
@@ -48,6 +48,15 @@ def create_certificate(course):
|
||||
if expires_after_yrs:
|
||||
expiry_date = add_years(nowdate(), expires_after_yrs)
|
||||
|
||||
default_certificate_template = frappe.db.get_value(
|
||||
"Property Setter",
|
||||
{
|
||||
"doc_type": "LMS Certificate",
|
||||
"property": "default_print_format",
|
||||
},
|
||||
"value",
|
||||
)
|
||||
|
||||
certificate = frappe.get_doc(
|
||||
{
|
||||
"doctype": "LMS Certificate",
|
||||
@@ -55,6 +64,7 @@ def create_certificate(course):
|
||||
"course": course,
|
||||
"issue_date": nowdate(),
|
||||
"expiry_date": expiry_date,
|
||||
"template": default_certificate_template,
|
||||
}
|
||||
)
|
||||
certificate.save(ignore_permissions=True)
|
||||
|
||||
Reference in New Issue
Block a user