mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
fix: linter and sider issues
This commit is contained in:
@@ -95,12 +95,12 @@ class TestExpenseClaim(unittest.TestCase):
|
|||||||
def test_rejected_expense_claim(self):
|
def test_rejected_expense_claim(self):
|
||||||
payable_account = get_payable_account(company_name)
|
payable_account = get_payable_account(company_name)
|
||||||
expense_claim = frappe.get_doc({
|
expense_claim = frappe.get_doc({
|
||||||
"doctype": "Expense Claim",
|
"doctype": "Expense Claim",
|
||||||
"employee": "_T-Employee-00001",
|
"employee": "_T-Employee-00001",
|
||||||
"payable_account": payable_account,
|
"payable_account": payable_account,
|
||||||
"approval_status": "Rejected",
|
"approval_status": "Rejected",
|
||||||
"expenses":
|
"expenses":
|
||||||
[{ "expense_type": "Travel", "default_account": "Travel Expenses - _TC4", "amount": 300, "sanctioned_amount": 200 }]
|
[{ "expense_type": "Travel", "default_account": "Travel Expenses - _TC4", "amount": 300, "sanctioned_amount": 200 }]
|
||||||
})
|
})
|
||||||
expense_claim.submit()
|
expense_claim.submit()
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ class TestExpenseClaim(unittest.TestCase):
|
|||||||
|
|
||||||
def test_expense_approver_perms(self):
|
def test_expense_approver_perms(self):
|
||||||
user = "test_approver_perm_emp@example.com"
|
user = "test_approver_perm_emp@example.com"
|
||||||
approver = make_employee(user, "_Test Company")
|
make_employee(user, "_Test Company")
|
||||||
|
|
||||||
# check doc shared
|
# check doc shared
|
||||||
payable_account = get_payable_account("_Test Company")
|
payable_account = get_payable_account("_Test Company")
|
||||||
@@ -160,21 +160,21 @@ def make_expense_claim(payable_account, amount, sanctioned_amount, company, acco
|
|||||||
|
|
||||||
currency, cost_center = frappe.db.get_value('Company', company, ['default_currency', 'cost_center'])
|
currency, cost_center = frappe.db.get_value('Company', company, ['default_currency', 'cost_center'])
|
||||||
expense_claim = {
|
expense_claim = {
|
||||||
"doctype": "Expense Claim",
|
"doctype": "Expense Claim",
|
||||||
"employee": employee,
|
"employee": employee,
|
||||||
"payable_account": payable_account,
|
"payable_account": payable_account,
|
||||||
"approval_status": "Approved",
|
"approval_status": "Approved",
|
||||||
"company": company,
|
"company": company,
|
||||||
'currency': currency,
|
"currency": currency,
|
||||||
"expenses": [{
|
"expenses": [{
|
||||||
"expense_type": "Travel",
|
"expense_type": "Travel",
|
||||||
"default_account": account,
|
"default_account": account,
|
||||||
"currency": currency,
|
"currency": currency,
|
||||||
"amount": amount,
|
"amount": amount,
|
||||||
"sanctioned_amount": sanctioned_amount,
|
"sanctioned_amount": sanctioned_amount,
|
||||||
"cost_center": cost_center
|
"cost_center": cost_center
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
if taxes:
|
if taxes:
|
||||||
expense_claim.update(taxes)
|
expense_claim.update(taxes)
|
||||||
|
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
to_date = add_days(date, 4),
|
to_date = add_days(date, 4),
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
docstatus = 1,
|
docstatus = 1,
|
||||||
status = "Approved"
|
status = "Approved"
|
||||||
))
|
))
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, leave_application.insert)
|
self.assertRaises(frappe.ValidationError, leave_application.insert)
|
||||||
@@ -364,7 +364,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
to_date = add_days(date, 4),
|
to_date = add_days(date, 4),
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
docstatus = 1,
|
docstatus = 1,
|
||||||
status = "Approved"
|
status = "Approved"
|
||||||
))
|
))
|
||||||
|
|
||||||
self.assertTrue(leave_application.insert())
|
self.assertTrue(leave_application.insert())
|
||||||
@@ -394,7 +394,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
to_date = add_days(date, 4),
|
to_date = add_days(date, 4),
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
docstatus = 1,
|
docstatus = 1,
|
||||||
status = "Approved"
|
status = "Approved"
|
||||||
))
|
))
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, leave_application.insert)
|
self.assertRaises(frappe.ValidationError, leave_application.insert)
|
||||||
@@ -509,7 +509,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
description = "_Test Reason",
|
description = "_Test Reason",
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
docstatus = 1,
|
docstatus = 1,
|
||||||
status = "Approved"
|
status = "Approved"
|
||||||
))
|
))
|
||||||
leave_application.submit()
|
leave_application.submit()
|
||||||
leave_ledger_entry = frappe.get_all('Leave Ledger Entry', fields='*', filters=dict(transaction_name=leave_application.name))
|
leave_ledger_entry = frappe.get_all('Leave Ledger Entry', fields='*', filters=dict(transaction_name=leave_application.name))
|
||||||
@@ -541,7 +541,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
description = "_Test Reason",
|
description = "_Test Reason",
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
docstatus = 1,
|
docstatus = 1,
|
||||||
status = "Approved"
|
status = "Approved"
|
||||||
))
|
))
|
||||||
leave_application.submit()
|
leave_application.submit()
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
def test_leave_approver_perms(self):
|
def test_leave_approver_perms(self):
|
||||||
employee = get_employee()
|
employee = get_employee()
|
||||||
user = "test_approver_perm_emp@example.com"
|
user = "test_approver_perm_emp@example.com"
|
||||||
approver = make_employee(user, "_Test Company")
|
make_employee(user, "_Test Company")
|
||||||
|
|
||||||
# set approver for employee
|
# set approver for employee
|
||||||
employee.reload()
|
employee.reload()
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ def validate_leave_allocation_against_leave_application(ledger):
|
|||||||
""", (ledger.employee, ledger.leave_type, ledger.from_date, ledger.to_date))
|
""", (ledger.employee, ledger.leave_type, ledger.from_date, ledger.to_date))
|
||||||
|
|
||||||
if leave_application_records:
|
if leave_application_records:
|
||||||
frappe.throw(_("Leave allocation %s is linked with leave application %s"
|
frappe.throw(_("Leave allocation {0} is linked with the Leave Application {1}").format(
|
||||||
% (ledger.transaction_name, ', '.join(leave_application_records))))
|
ledger.transaction_name, ', '.join(leave_application_records)))
|
||||||
|
|
||||||
def create_leave_ledger_entry(ref_doc, args, submit=True):
|
def create_leave_ledger_entry(ref_doc, args, submit=True):
|
||||||
ledger = frappe._dict(
|
ledger = frappe._dict(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class TestShiftRequest(unittest.TestCase):
|
|||||||
def test_shift_request_approver_perms(self):
|
def test_shift_request_approver_perms(self):
|
||||||
employee = frappe.get_doc("Employee", "_T-Employee-00001")
|
employee = frappe.get_doc("Employee", "_T-Employee-00001")
|
||||||
user = "test_approver_perm_emp@example.com"
|
user = "test_approver_perm_emp@example.com"
|
||||||
approver = make_employee(user, "_Test Company")
|
make_employee(user, "_Test Company")
|
||||||
|
|
||||||
# set approver for employee
|
# set approver for employee
|
||||||
employee.reload()
|
employee.reload()
|
||||||
|
|||||||
Reference in New Issue
Block a user