Test case fixes
diff --git a/erpnext/hr/doctype/employee_transfer/employee_transfer.py b/erpnext/hr/doctype/employee_transfer/employee_transfer.py
index 99e7ad6..c730e02 100644
--- a/erpnext/hr/doctype/employee_transfer/employee_transfer.py
+++ b/erpnext/hr/doctype/employee_transfer/employee_transfer.py
@@ -26,7 +26,7 @@
new_employee.name = None
new_employee.employee_number = None
new_employee = update_employee(new_employee, self.transfer_details, date=self.transfer_date)
- if self.company != self.new_company:
+ if self.new_company and self.company != self.new_company:
new_employee.internal_work_history = []
new_employee.date_of_joining = self.transfer_date
new_employee.company = self.new_company
@@ -41,7 +41,7 @@
employee.db_set("status", "Left")
else:
employee = update_employee(employee, self.transfer_details, date=self.transfer_date)
- if self.company != self.new_company:
+ if self.new_company and self.company != self.new_company:
employee.company = self.new_company
employee.date_of_joining = self.transfer_date
employee.save()
diff --git a/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py b/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
index 3dae1a9..93fc7a2 100644
--- a/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
+++ b/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
@@ -6,7 +6,7 @@
import frappe
import unittest
from frappe.utils import getdate, add_days
-from erpnext.hr.doctype.salary_structure.test_salary_structure import make_employee
+from erpnext.hr.doctype.employee.test_employee import make_employee
class TestEmployeeTransfer(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/hr/doctype/salary_component/test_records.json b/erpnext/hr/doctype/salary_component/test_records.json
index bd3a7d4..69491be 100644
--- a/erpnext/hr/doctype/salary_component/test_records.json
+++ b/erpnext/hr/doctype/salary_component/test_records.json
@@ -1,22 +1,41 @@
[
{
- "doctype": "Salary Component",
- "salary_component": "_Test Basic Salary"
+ "doctype": "Salary Component",
+ "salary_component": "_Test Basic Salary",
+ "type": "Earning",
+ "is_payable": 1,
+ "is_tax_applicable": 1
},
{
- "doctype": "Salary Component",
- "salary_component": "_Test Allowance"
+ "doctype": "Salary Component",
+ "salary_component": "_Test Allowance",
+ "type": "Earning",
+ "is_payable": 1,
+ "is_tax_applicable": 1
},
{
- "doctype": "Salary Component",
- "salary_component": "_Test Professional Tax"
+ "doctype": "Salary Component",
+ "salary_component": "_Test Professional Tax",
+ "type": "Deduction"
},
{
- "doctype": "Salary Component",
- "salary_component": "_Test TDS"
+ "doctype": "Salary Component",
+ "salary_component": "_Test TDS",
+ "type": "Deduction"
},
{
- "doctype": "Salary Component",
- "salary_component": "Basic"
+ "doctype": "Salary Component",
+ "salary_component": "Basic",
+ "type": "Earning",
+ "is_payable": 1,
+ "is_tax_applicable": 1
+ },
+ {
+ "doctype": "Salary Component",
+ "salary_component": "Leave Encashment",
+ "type": "Earning",
+ "is_payable": 1,
+ "is_tax_applicable": 1,
+ "is_additional_component": 1
}
]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_component/test_salary_component.py b/erpnext/hr/doctype/salary_component/test_salary_component.py
index 599bc6a..c13843a 100644
--- a/erpnext/hr/doctype/salary_component/test_salary_component.py
+++ b/erpnext/hr/doctype/salary_component/test_salary_component.py
@@ -10,3 +10,16 @@
class TestSalaryComponent(unittest.TestCase):
pass
+
+
+def create_salary_component(component_name, **args):
+ if not frappe.db.exists("Salary Component", component_name):
+ frappe.get_doc({
+ "doctype": "Salary Component",
+ "salary_component": component_name,
+ "type": args.get("type") or "Earning",
+ "is_payable": args.get("is_payable") or 1,
+ "is_tax_applicable": args.get("is_tax_applicable") or 1,
+ "is_additional_component": args.get("is_additional_component") or 1
+ }).insert()
+
\ No newline at end of file