def get_earnings_component(): make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"]) make_deduction_salary_component(["Professional Tax", "TDS"]) return [ { "salary_component": 'Basic Salary', "abbr": 'BS', "condition": 'base > 10000', "formula": 'base*.2', "idx": 1 }, { "salary_component": 'Basic Salary', "abbr": 'BS', "condition": 'base < 10000', "formula": 'base*.1', "idx": 2 }, { "salary_component": 'HRA', "abbr": 'H', "amount": 10000, "idx": 3 }, { "salary_component": 'Special Allowance', "abbr": 'SA', "condition": 'H < 10000', "formula": 'BS*.5', "idx": 4 }, ]
def setUp(self): self.make_holiday_list() frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List") make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"]) make_deduction_salary_component(["Professional Tax", "TDS"]) make_employee("*****@*****.**") make_employee("*****@*****.**")
def setUp(self): self.make_holiday_list() frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List") make_earning_salary_component(["Basic Salary", "Allowance", "HRA"]) make_deduction_salary_component(["Professional Tax", "TDS"]) self.make_employee("*****@*****.**") self.make_employee("*****@*****.**")
def get_earnings_component(): make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"]) make_deduction_salary_component(["Professional Tax", "TDS"]) return [ { "salary_component": 'Basic Salary', "abbr":'BS', "condition": 'base > 10000', "formula": 'base*.2', "idx": 1 }, { "salary_component": 'Basic Salary', "abbr":'BS', "condition": 'base < 10000', "formula": 'base*.1', "idx": 2 }, { "salary_component": 'HRA', "abbr":'H', "amount": 10000, "idx": 3 }, { "salary_component": 'Special Allowance', "abbr":'SA', "condition": 'H < 10000', "formula": 'BS*.5', "idx": 4 }, ]
def setUp(self): for dt in ["Salary Slip", "Salary Component", "Salary Component Account", "Payroll Entry", "Loan"]: frappe.db.sql("delete from `tab%s`" % dt) make_earning_salary_component(setup=True) make_deduction_salary_component(setup=True) frappe.db.set_value("HR Settings", None, "email_salary_slip_to_employee", 0)
def setUp(self): for dt in ["Salary Slip", "Salary Component", "Salary Component Account", "Payroll Entry", "Salary Structure", "Salary Structure Assignment", "Payroll Employee Detail", "Additional Salary"]: frappe.db.sql("delete from `tab%s`" % dt) make_earning_salary_component(setup=True, company_list=["_Test Company"]) make_deduction_salary_component(setup=True, company_list=["_Test Company"]) frappe.db.set_value("HR Settings", None, "email_salary_slip_to_employee", 0)
def setUp(self): for dt in [ "Salary Slip", "Salary Component", "Salary Component Account", "Payroll Entry", "Loan" ]: frappe.db.sql("delete from `tab%s`" % dt) make_earning_salary_component(setup=True) make_deduction_salary_component(setup=True)
def make_salary_structure(salary_structure, payroll_frequency, employee=None, dont_submit=False, other_details=None, test_tax=False): if test_tax: frappe.db.sql("""delete from `tabSalary Structure` where name=%s""",(salary_structure)) if not frappe.db.exists('Salary Structure', salary_structure): details = { "doctype": "Salary Structure", "name": salary_structure, "company": erpnext.get_default_company(), "earnings": make_earning_salary_component(test_tax=test_tax), "deductions": make_deduction_salary_component(test_tax=test_tax), "payroll_frequency": payroll_frequency, "payment_account": get_random("Account") } if other_details and isinstance(other_details, dict): details.update(other_details) salary_structure_doc = frappe.get_doc(details).insert() if not dont_submit: salary_structure_doc.submit() else: salary_structure_doc = frappe.get_doc("Salary Structure", salary_structure) if employee and not frappe.db.get_value("Salary Structure Assignment", {'employee':employee, 'docstatus': 1}) and salary_structure_doc.docstatus==1: create_salary_structure_assignment(employee, salary_structure) return salary_structure_doc
def make_salary_structure(salary_structure, payroll_frequency, employee=None, dont_submit=False, other_details=None, test_tax=False): if test_tax: frappe.db.sql("""delete from `tabSalary Structure` where name=%s""",(salary_structure)) if not frappe.db.exists('Salary Structure', salary_structure): details = { "doctype": "Salary Structure", "name": salary_structure, "company": erpnext.get_default_company(), "earnings": make_earning_salary_component(test_tax=test_tax), "deductions": make_deduction_salary_component(test_tax=test_tax), "payroll_frequency": payroll_frequency, "payment_account": get_random("Account") } if other_details and isinstance(other_details, dict): details.update(other_details) salary_structure_doc = frappe.get_doc(details).insert() if not dont_submit: salary_structure_doc.submit() else: salary_structure_doc = frappe.get_doc("Salary Structure", salary_structure) if employee and not frappe.db.get_value("Salary Structure Assignment", {'employee':employee, 'docstatus': 1}) and salary_structure_doc.docstatus==1: create_salary_structure_assignment(employee, salary_structure) return salary_structure_doc
def setUp(self): for dt in ["Salary Slip", "Salary Component", "Salary Component Account", "Payroll Entry", "Loan"]: frappe.db.sql("delete from `tab%s`" % dt) make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA", "Leave Encashment"]) make_deduction_salary_component(["Professional Tax", "TDS"])