|
|
@ -77,9 +77,27 @@ class TestExpenseClaim(unittest.TestCase): |
|
|
|
]) |
|
|
|
|
|
|
|
for gle in gl_entries: |
|
|
|
self.assertEqual(expected_values[gle.account][0], gle.account) |
|
|
|
self.assertEqual(expected_values[gle.account][1], gle.debit) |
|
|
|
self.assertEqual(expected_values[gle.account][2], gle.credit) |
|
|
|
self.assertEquals(expected_values[gle.account][0], gle.account) |
|
|
|
self.assertEquals(expected_values[gle.account][1], gle.debit) |
|
|
|
self.assertEquals(expected_values[gle.account][2], gle.credit) |
|
|
|
|
|
|
|
def test_rejected_expense_claim(self): |
|
|
|
payable_account = get_payable_account("Wind Power LLC") |
|
|
|
expense_claim = frappe.get_doc({ |
|
|
|
"doctype": "Expense Claim", |
|
|
|
"employee": "_T-Employee-00001", |
|
|
|
"payable_account": payable_account, |
|
|
|
"approval_status": "Rejected", |
|
|
|
"expenses": |
|
|
|
[{ "expense_type": "Travel", "default_account": "Travel Expenses - WP", "claim_amount": 300, "sanctioned_amount": 200 }] |
|
|
|
}) |
|
|
|
expense_claim.submit() |
|
|
|
|
|
|
|
self.assertEquals(expense_claim.status, 'Rejected') |
|
|
|
self.assertEquals(expense_claim.total_sanctioned_amount, 0.0) |
|
|
|
|
|
|
|
gl_entry = frappe.get_all('GL Entry', {'voucher_type': 'Expense Claim', 'voucher_no': expense_claim.name}) |
|
|
|
self.assertEquals(len(gl_entry), 0) |
|
|
|
|
|
|
|
def get_payable_account(company): |
|
|
|
return frappe.db.get_value('Company', company, 'default_payable_account') |
|
|
@ -89,6 +107,7 @@ def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, |
|
|
|
"doctype": "Expense Claim", |
|
|
|
"employee": "_T-Employee-00001", |
|
|
|
"payable_account": payable_account, |
|
|
|
"approval_status": "Approved", |
|
|
|
"company": company, |
|
|
|
"expenses": |
|
|
|
[{ "expense_type": "Travel", "default_account": account, "claim_amount": claim_amount, "sanctioned_amount": sanctioned_amount }] |
|
|
@ -100,5 +119,3 @@ def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, |
|
|
|
|
|
|
|
expense_claim.submit() |
|
|
|
return expense_claim |
|
|
|
|
|
|
|
|
|
|
|