[fix] Modified Grant Application Test

This commit is contained in:
Vishal 2017-11-03 17:29:37 +05:30
parent b4a8e11edc
commit da05b3ce7f
3 changed files with 34 additions and 3 deletions

View File

@ -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
}
});
}
});
}
});

View File

@ -28,6 +28,7 @@ def get_list_context(context):
context.order_by = 'creation desc'
context.introduction ='<div>Grant Application List</div><br><a class="btn btn-primary" href="/my-grant?new=1">Apply for new Grant Application</a>'
#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"
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='<p> Please Review this grant application</p><br>' ,
reference_doctype=grant.doctype,
reference_name=grant.name
)
grant.status = "In Progress"
meeting.save()
frappe.msgprint(_("Invitation Sent"))

View File

@ -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);