mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
[fix] test case fix for expense claim
This commit is contained in:
@@ -43,7 +43,7 @@ def work():
|
|||||||
|
|
||||||
rand = random.random()
|
rand = random.random()
|
||||||
|
|
||||||
if rand >= 0.3 and rand <= 0.6 :
|
if rand < 0.4:
|
||||||
expense_claim.approval_status = "Approved"
|
expense_claim.approval_status = "Approved"
|
||||||
update_sanctioned_amount(expense_claim)
|
update_sanctioned_amount(expense_claim)
|
||||||
expense_claim.submit()
|
expense_claim.submit()
|
||||||
@@ -57,7 +57,7 @@ def work():
|
|||||||
je.flags.ignore_permissions = 1
|
je.flags.ignore_permissions = 1
|
||||||
je.submit()
|
je.submit()
|
||||||
|
|
||||||
if rand < 0.3:
|
elif rand < 0.2:
|
||||||
expense_claim.approval_status = "Rejected"
|
expense_claim.approval_status = "Rejected"
|
||||||
expense_claim.submit()
|
expense_claim.submit()
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class TestExpenseClaim(unittest.TestCase):
|
|||||||
"project": "_Test Project 1",
|
"project": "_Test Project 1",
|
||||||
"task": task_name,
|
"task": task_name,
|
||||||
"expenses":
|
"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()
|
expense_claim.submit()
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ class TestExpenseClaim(unittest.TestCase):
|
|||||||
"project": "_Test Project 1",
|
"project": "_Test Project 1",
|
||||||
"task": task_name,
|
"task": task_name,
|
||||||
"expenses":
|
"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()
|
expense_claim2.submit()
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// 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", {
|
||||||
var d = locals[cdt][cdn];
|
refresh: function(frm){
|
||||||
return{
|
frm.fields_dict["accounts"].grid.get_field("default_account").get_query = function(frm, cdt, cdn){
|
||||||
filters: {
|
var d = locals[cdt][cdn];
|
||||||
"is_group": 0,
|
return{
|
||||||
"root_type": "Expense",
|
filters: {
|
||||||
'company': d.company
|
"is_group": 0,
|
||||||
|
"root_type": "Expense",
|
||||||
|
'company': d.company
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user