fix: requested changes and sider
This commit is contained in:
parent
66b697cd05
commit
af9f172be8
@ -2,15 +2,15 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Gratuity', {
|
||||
setup: function(frm){
|
||||
frm.set_query('salary_component', function() {
|
||||
setup: function (frm) {
|
||||
frm.set_query('salary_component', function () {
|
||||
return {
|
||||
filters: {
|
||||
type: "Earning"
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("expense_account", function() {
|
||||
frm.set_query("expense_account", function () {
|
||||
return {
|
||||
filters: {
|
||||
"root_type": "Expense",
|
||||
@ -20,7 +20,7 @@ frappe.ui.form.on('Gratuity', {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("payable_account", function() {
|
||||
frm.set_query("payable_account", function () {
|
||||
return {
|
||||
filters: {
|
||||
"root_type": "Liability",
|
||||
@ -30,16 +30,16 @@ frappe.ui.form.on('Gratuity', {
|
||||
};
|
||||
});
|
||||
},
|
||||
refresh: function(frm){
|
||||
if(frm.doc.docstatus === 1 && frm.doc.pay_via_salary_slip === 0 && frm.doc.status === "Unpaid") {
|
||||
frm.add_custom_button(__("Create Payment Entry"), function() {
|
||||
refresh: function (frm) {
|
||||
if (frm.doc.docstatus === 1 && frm.doc.pay_via_salary_slip === 0 && frm.doc.status === "Unpaid") {
|
||||
frm.add_custom_button(__("Create Payment Entry"), function () {
|
||||
return frappe.call({
|
||||
method: 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry',
|
||||
args: {
|
||||
"dt": frm.doc.doctype,
|
||||
"dn": frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
callback: function (r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
@ -47,18 +47,18 @@ frappe.ui.form.on('Gratuity', {
|
||||
});
|
||||
}
|
||||
},
|
||||
employee: function(frm) {
|
||||
employee: function (frm) {
|
||||
frm.events.calculate_work_experience_and_amount(frm);
|
||||
},
|
||||
gratuity_rule: function(frm){
|
||||
gratuity_rule: function (frm) {
|
||||
frm.events.calculate_work_experience_and_amount(frm);
|
||||
},
|
||||
calculate_work_experience_and_amount: function(frm) {
|
||||
calculate_work_experience_and_amount: function (frm) {
|
||||
|
||||
if(frm.doc.employee && frm.doc.gratuity_rule){
|
||||
if (frm.doc.employee && frm.doc.gratuity_rule) {
|
||||
frappe.call({
|
||||
method:"erpnext.payroll.doctype.gratuity.gratuity.calculate_work_experience_and_amount",
|
||||
args:{
|
||||
method: "erpnext.payroll.doctype.gratuity.gratuity.calculate_work_experience_and_amount",
|
||||
args: {
|
||||
employee: frm.doc.employee,
|
||||
gratuity_rule: frm.doc.gratuity_rule
|
||||
}
|
||||
@ -69,4 +69,4 @@ frappe.ui.form.on('Gratuity', {
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
@ -6,15 +6,16 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_employee_salary_slip
|
||||
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_employee_salary_slip, make_earning_salary_component
|
||||
from erpnext.payroll.doctype.gratuity.gratuity import get_last_salary_slip
|
||||
from erpnext.regional.united_arab_emirates.setup import create_gratuity_rule
|
||||
from erpnext.hr.doctype.expense_claim.test_expense_claim import get_payable_account
|
||||
from frappe.utils import getdate, add_days, get_datetime, flt
|
||||
|
||||
|
||||
test_dependencies = ["Salary Component", "Salary Slip"]
|
||||
class TestGratuity(unittest.TestCase):
|
||||
def setUp(self):
|
||||
make_earning_salary_component()
|
||||
frappe.db.sql("DELETE FROM `tabGratuity`")
|
||||
frappe.db.sql("DELETE FROM `tabAdditional Salary` WHERE ref_doctype = 'Gratuity'")
|
||||
|
||||
@ -168,15 +169,9 @@ def create_employee_and_get_last_salary_slip():
|
||||
else:
|
||||
salary_slip = get_last_salary_slip(employee)
|
||||
|
||||
#just to see what going on travis will remove this
|
||||
print(frappe.db.get_value("Employee", "test_employee@salary.com", "company"))
|
||||
print(frappe.db.get_value("Employee", "test_employee@salary.com", "holiday_list"))
|
||||
|
||||
if not frappe.db.get_value("Employee", "test_employee@salary.com", "holiday_list"):
|
||||
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_holiday_list
|
||||
make_holiday_list()
|
||||
frappe.db.set_value("Company", '_Test Company', "default_holiday_list", "Salary Slip Test Holiday List")
|
||||
|
||||
print(frappe.db.get_value("Employee", "test_employee@salary.com", "holiday_list"))
|
||||
|
||||
return employee, salary_slip
|
||||
|
@ -25,17 +25,16 @@ frappe.ui.form.on('Gratuity Rule Slab', {
|
||||
gratuity_rule_slabs_add(frm, cdt, cdn) {
|
||||
let row = locals[cdt][cdn];
|
||||
let array_idx = row.idx - 1;
|
||||
if(array_idx > 0){
|
||||
row.from_year = cur_frm.doc.gratuity_rule_slabs[array_idx-1].to_year;
|
||||
if (array_idx > 0) {
|
||||
row.from_year = cur_frm.doc.gratuity_rule_slabs[array_idx - 1].to_year;
|
||||
frm.refresh();
|
||||
}
|
||||
},
|
||||
|
||||
to_year(frm, cdt, cdn) {
|
||||
let row = locals[cdt][cdn];
|
||||
if (row.to_year <= row.from_year && row.to_year === 0){
|
||||
if (row.to_year <= row.from_year && row.to_year === 0) {
|
||||
frappe.throw(__("To(Year) year can not be less than From(year) "));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
@ -21,6 +21,7 @@ from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_ta
|
||||
class TestSalarySlip(unittest.TestCase):
|
||||
def setUp(self):
|
||||
setup_test()
|
||||
|
||||
def tearDown(self):
|
||||
frappe.db.set_value("Payroll Settings", None, "include_holidays_in_total_working_days", 0)
|
||||
frappe.set_user("Administrator")
|
||||
|
@ -12,13 +12,9 @@ from erpnext.payroll.doctype.gratuity_rule.gratuity_rule import get_gratuity_rul
|
||||
def setup(company=None, patch=True):
|
||||
make_custom_fields()
|
||||
add_print_formats()
|
||||
<<<<<<< HEAD
|
||||
add_custom_roles_for_reports()
|
||||
add_permissions()
|
||||
create_standard_documents()
|
||||
=======
|
||||
create_gratuity_rule()
|
||||
>>>>>>> test: gratuity
|
||||
|
||||
if company:
|
||||
create_sales_tax(company)
|
||||
|
Loading…
x
Reference in New Issue
Block a user