test case
This commit is contained in:
parent
7b2870431e
commit
d73dd056d6
@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
var in_progress = false;
|
||||
|
||||
frappe.ui.form.on('Payroll Entry', {
|
||||
onload: function (frm) {
|
||||
frm.doc.posting_date = frappe.datetime.nowdate();
|
||||
@ -35,7 +37,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
"is_group": 0,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
}
|
||||
};
|
||||
}),
|
||||
frm.set_query("cost_center", function () {
|
||||
return {
|
||||
@ -43,15 +45,15 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
"is_group": 0,
|
||||
company: frm.doc.company
|
||||
}
|
||||
}
|
||||
};
|
||||
}),
|
||||
frm.set_query("project", function () {
|
||||
return {
|
||||
filters: {
|
||||
company: frm.doc.company
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
payroll_frequency: function (frm) {
|
||||
@ -63,7 +65,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
frm.trigger("set_end_date");
|
||||
}else{
|
||||
// reset flag
|
||||
in_progress = false
|
||||
in_progress = false;
|
||||
}
|
||||
},
|
||||
|
||||
@ -71,7 +73,6 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
||||
},
|
||||
|
||||
|
||||
set_start_end_dates: function (frm) {
|
||||
if (!frm.doc.salary_slip_based_on_timesheet) {
|
||||
frappe.call({
|
||||
@ -87,7 +88,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
frm.set_value('end_date', r.message.end_date);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -109,19 +110,19 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
|
||||
// Create salary slips
|
||||
|
||||
cur_frm.cscript.custom_before_submit = function (doc, cdt, cdn) {
|
||||
cur_frm.cscript.custom_before_submit = function (doc) {
|
||||
return $c('runserverobj', { 'method': 'create_salary_slips', 'docs': doc });
|
||||
}
|
||||
};
|
||||
|
||||
// Submit salary slips
|
||||
|
||||
submit_salary_slip = function (frm, cdt, cdn) {
|
||||
doc = frm.doc;
|
||||
let submit_salary_slip = function (frm) {
|
||||
var doc = frm.doc;
|
||||
return $c('runserverobj', { 'method': 'submit_salary_slips', 'docs': doc });
|
||||
}
|
||||
|
||||
make_bank_entry = function (frm, cdt, cdn) {
|
||||
doc = frm.doc;
|
||||
let make_bank_entry = function (frm) {
|
||||
var doc = frm.doc;
|
||||
if (doc.company && doc.start_date && doc.end_date) {
|
||||
return frappe.call({
|
||||
doc: cur_frm.doc,
|
||||
|
@ -114,6 +114,7 @@ class PayrollEntry(Document):
|
||||
def create_log(self, ss_list):
|
||||
if not ss_list or len(ss_list) < 1:
|
||||
frappe.throw(_("No employee for the above selected criteria OR salary slip already created"))
|
||||
return
|
||||
|
||||
def get_sal_slip_list(self, ss_status, as_dict=False):
|
||||
"""
|
||||
@ -173,7 +174,7 @@ class PayrollEntry(Document):
|
||||
Possible reasons: <br>\
|
||||
1. Net pay is less than 0. <br>\
|
||||
2. Company Email Address specified in employee master is not valid. <br>")
|
||||
|
||||
return
|
||||
def format_as_links(self, salary_slip):
|
||||
return ['<a href="#Form/Salary Slip/{0}">{0}</a>'.format(salary_slip)]
|
||||
|
||||
@ -414,9 +415,7 @@ def get_end_date(start_date, frequency):
|
||||
def get_month_details(year, month):
|
||||
ysd = frappe.db.get_value("Fiscal Year", year, "year_start_date")
|
||||
if ysd:
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import calendar, datetime
|
||||
frappe.msgprint
|
||||
diff_mnt = cint(month)-cint(ysd.month)
|
||||
if diff_mnt<0:
|
||||
diff_mnt = 12-int(ysd.month)+cint(month)
|
||||
|
@ -1,4 +1,4 @@
|
||||
QUnit.module('HR')
|
||||
QUnit.module('HR');
|
||||
|
||||
QUnit.test("test: Payroll Entry", function (assert) {
|
||||
assert.expect(5);
|
||||
@ -10,29 +10,29 @@ QUnit.test("test: Payroll Entry", function (assert) {
|
||||
{company: 'For Testing'},
|
||||
{posting_date: frappe.datetime.add_days(frappe.datetime.nowdate(), 0)},
|
||||
{payroll_frequency: 'Monthly'},
|
||||
// {start_date: },
|
||||
{cost_center: 'Main - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
|
||||
]);
|
||||
},
|
||||
|
||||
() => frappe.timeout(1),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.company, 'For Testing');
|
||||
assert.equal(cur_frm.doc.posting_date, frappe.datetime.add_days(frappe.datetime.nowdate(), 0));
|
||||
assert.equal(cur_frm.doc.cost_center, 'Main - FT');
|
||||
},
|
||||
|
||||
() => frappe.click_button('Submit'),
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.click_button('Yes'),
|
||||
() => frappe.timeout(2),
|
||||
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.company, 'For Testing');
|
||||
assert.equal(cur_frm.doc.posting_date, frappe.datetime.add_days(frappe.datetime.nowdate(), 0));
|
||||
assert.equal(cur_frm.doc.cost_center, 'Main - FT');
|
||||
},
|
||||
|
||||
() => frappe.click_button('View Salary Slip'),
|
||||
() => frappe.timeout(2),
|
||||
() => assert.equal(cur_list.data[0].docstatus, 0),
|
||||
|
||||
() => frappe.set_route('Form', 'Payroll Entry', 'Payroll 0041'),
|
||||
() => frappe.set_route('Form', 'Payroll Entry', 'Payroll 0001'),
|
||||
() => frappe.click_button('Submit Salary Slip'),
|
||||
() => frappe.timeout(2),
|
||||
() => frappe.timeout(3),
|
||||
|
||||
() => frappe.click_button('Close'),
|
||||
() => frappe.timeout(1),
|
||||
|
@ -3,7 +3,6 @@
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestPayrollEntry(unittest.TestCase):
|
||||
|
@ -78,6 +78,7 @@ erpnext/hr/doctype/training_feedback/test_training_feedback.js
|
||||
erpnext/hr/doctype/loan_type/test_loan_type.js
|
||||
erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
|
||||
erpnext/hr/doctype/employee_loan/test_employee_loan.js
|
||||
erpnext/hr/doctype/payroll_entry/test_payroll_entry.js
|
||||
erpnext/buying/doctype/supplier/test_supplier.js
|
||||
erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
|
||||
erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
|
||||
|
Loading…
x
Reference in New Issue
Block a user