Test case fixes
This commit is contained in:
parent
0484547150
commit
227489193b
@ -26,7 +26,7 @@ class EmployeeTransfer(Document):
|
||||
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 @@ class EmployeeTransfer(Document):
|
||||
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()
|
||||
|
@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
||||
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):
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -10,3 +10,16 @@ import unittest
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user