mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
Test case fixes
This commit is contained in:
@@ -26,7 +26,7 @@ class EmployeeTransfer(Document):
|
|||||||
new_employee.name = None
|
new_employee.name = None
|
||||||
new_employee.employee_number = None
|
new_employee.employee_number = None
|
||||||
new_employee = update_employee(new_employee, self.transfer_details, date=self.transfer_date)
|
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.internal_work_history = []
|
||||||
new_employee.date_of_joining = self.transfer_date
|
new_employee.date_of_joining = self.transfer_date
|
||||||
new_employee.company = self.new_company
|
new_employee.company = self.new_company
|
||||||
@@ -41,7 +41,7 @@ class EmployeeTransfer(Document):
|
|||||||
employee.db_set("status", "Left")
|
employee.db_set("status", "Left")
|
||||||
else:
|
else:
|
||||||
employee = update_employee(employee, self.transfer_details, date=self.transfer_date)
|
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.company = self.new_company
|
||||||
employee.date_of_joining = self.transfer_date
|
employee.date_of_joining = self.transfer_date
|
||||||
employee.save()
|
employee.save()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
from frappe.utils import getdate, add_days
|
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):
|
class TestEmployeeTransfer(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -1,22 +1,41 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"doctype": "Salary Component",
|
"doctype": "Salary Component",
|
||||||
"salary_component": "_Test Basic Salary"
|
"salary_component": "_Test Basic Salary",
|
||||||
|
"type": "Earning",
|
||||||
|
"is_payable": 1,
|
||||||
|
"is_tax_applicable": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Salary Component",
|
"doctype": "Salary Component",
|
||||||
"salary_component": "_Test Allowance"
|
"salary_component": "_Test Allowance",
|
||||||
|
"type": "Earning",
|
||||||
|
"is_payable": 1,
|
||||||
|
"is_tax_applicable": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Salary Component",
|
"doctype": "Salary Component",
|
||||||
"salary_component": "_Test Professional Tax"
|
"salary_component": "_Test Professional Tax",
|
||||||
|
"type": "Deduction"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Salary Component",
|
"doctype": "Salary Component",
|
||||||
"salary_component": "_Test TDS"
|
"salary_component": "_Test TDS",
|
||||||
|
"type": "Deduction"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Salary Component",
|
"doctype": "Salary Component",
|
||||||
"salary_component": "Basic"
|
"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):
|
class TestSalaryComponent(unittest.TestCase):
|
||||||
pass
|
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()
|
||||||
|
|
||||||
Reference in New Issue
Block a user