Test case fixes

This commit is contained in:
Nabin Hait 2018-06-21 11:35:51 +05:30
parent 0484547150
commit 227489193b
4 changed files with 45 additions and 13 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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
}
]

View File

@ -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()