diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.js b/erpnext/non_profit/doctype/grant_application/grant_application.js index bfc2f655d68..e13fee9b5ad 100644 --- a/erpnext/non_profit/doctype/grant_application/grant_application.js +++ b/erpnext/non_profit/doctype/grant_application/grant_application.js @@ -13,5 +13,15 @@ frappe.ui.form.on('Grant Application', { frappe.contacts.clear_address_and_contact(frm); } + frm.add_custom_button(__("Send Grant Review Email"), function() { + if (frm.doc.status==="Received") { + frappe.call({ + method: "erpnext.non_profit.doctype.grant_application.grant_application.send_grant_review_emails", + args: { + grant_application: frm.doc.name + } + }); + } + }); } }); diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.py b/erpnext/non_profit/doctype/grant_application/grant_application.py index 44127f95a08..9f118c85372 100644 --- a/erpnext/non_profit/doctype/grant_application/grant_application.py +++ b/erpnext/non_profit/doctype/grant_application/grant_application.py @@ -28,6 +28,7 @@ def get_list_context(context): context.order_by = 'creation desc' context.introduction ='
Grant Application List

Apply for new Grant Application' +#Assement Manager review grant on website and submit result @frappe.whitelist(allow_guest=True) def assessment_result(title, assessment_scale, note): vote = frappe.get_doc("Grant Application", title) @@ -35,4 +36,24 @@ def assessment_result(title, assessment_scale, note): vote.note = note vote.save() frappe.db.commit() - return "Thank you for Assessment Review" \ No newline at end of file + return "Thank you for Assessment Review" + + + +@frappe.whitelist() +def send_grant_review_emails(grant_application): + grant = frappe.get_doc("Grant Application", grant_application) + + frappe.sendmail( + recipients= grant.assessment_manager, + sender=frappe.session.user, + subject=grant.title, + message='

Please Review this grant application


' , + reference_doctype=grant.doctype, + reference_name=grant.name + ) + + grant.status = "In Progress" + meeting.save() + + frappe.msgprint(_("Invitation Sent")) diff --git a/erpnext/non_profit/doctype/grant_application/test_grant_application.js b/erpnext/non_profit/doctype/grant_application/test_grant_application.js index 89bf35e1ad8..78d48d30757 100644 --- a/erpnext/non_profit/doctype/grant_application/test_grant_application.js +++ b/erpnext/non_profit/doctype/grant_application/test_grant_application.js @@ -12,7 +12,7 @@ QUnit.test("test: Grant Application", function (assert) { // insert a new Member () => frappe.tests.make('Grant Application', [ // values to be set - {organization: 'Test Organization'}, + {title: 'Test Organization'}, {grant_applicant_name:'Test Applicant'}, {email: 'test@example.com'}, {grant_description:'Test message'}, @@ -21,7 +21,7 @@ QUnit.test("test: Grant Application", function (assert) { {grant_past_record:'NO'} ]), () => { - assert.equal(cur_frm.doc.organization, 'Test Organization'); + assert.equal(cur_frm.doc.title, 'Test Organization'); assert.equal(cur_frm.doc.grant_applicant_name, 'Test Applicant'); assert.equal(cur_frm.doc.email, 'test@example.com'); assert.equal(cur_frm.doc.amount, 150000);