[fix] test case fix for expense claim

This commit is contained in:
Saurabh 2016-07-18 16:22:51 +05:30
parent 718d835f45
commit 9cba6e1f25
3 changed files with 16 additions and 12 deletions

View File

@ -43,7 +43,7 @@ def work():
rand = random.random()
if rand >= 0.3 and rand <= 0.6 :
if rand < 0.4:
expense_claim.approval_status = "Approved"
update_sanctioned_amount(expense_claim)
expense_claim.submit()
@ -57,7 +57,7 @@ def work():
je.flags.ignore_permissions = 1
je.submit()
if rand < 0.3:
elif rand < 0.2:
expense_claim.approval_status = "Rejected"
expense_claim.submit()

View File

@ -30,7 +30,7 @@ class TestExpenseClaim(unittest.TestCase):
"project": "_Test Project 1",
"task": task_name,
"expenses":
[{ "expense_type": "Food", "claim_amount": 300, "sanctioned_amount": 200 }]
[{ "expense_type": "Food", "default_account": "Entertainment Expenses - _TC", "claim_amount": 300, "sanctioned_amount": 200 }]
})
expense_claim.submit()
@ -44,7 +44,7 @@ class TestExpenseClaim(unittest.TestCase):
"project": "_Test Project 1",
"task": task_name,
"expenses":
[{ "expense_type": "Food", "claim_amount": 600, "sanctioned_amount": 500 }]
[{ "expense_type": "Food", "default_account": "Entertainment Expenses - _TC", "claim_amount": 600, "sanctioned_amount": 500 }]
})
expense_claim2.submit()

View File

@ -1,7 +1,9 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
frappe.ui.form.on("Expense Claim Type", {
refresh: function(frm){
frm.fields_dict["accounts"].grid.get_field("default_account").get_query = function(frm, cdt, cdn){
var d = locals[cdt][cdn];
return{
filters: {
@ -10,4 +12,6 @@ cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
'company': d.company
}
}
});
}
}
})