Merge pull request #22445 from Alchez/dev-job-offer-list-view
fix: setup status indicators for Job Offer and Job Applicant (develop)
diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
index f42b9ad..be9a2d3 100644
--- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
@@ -271,6 +271,7 @@
# as per assigned salary structure 40500 in monthly salary so 236000*5/100/12
frappe.db.sql("""delete from `tabPayroll Period`""")
frappe.db.sql("""delete from `tabSalary Component`""")
+ frappe.db.sql("""delete from `tabAdditional Salary`""")
payroll_period = create_payroll_period()
diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure.js b/erpnext/payroll/doctype/salary_structure/salary_structure.js
index ca458f9..ad93a2f 100755
--- a/erpnext/payroll/doctype/salary_structure/salary_structure.js
+++ b/erpnext/payroll/doctype/salary_structure/salary_structure.js
@@ -35,7 +35,9 @@
d.show()
});
- frm.get_field("conditions_and_formula_variable_and_example").$wrapper.append(frm.doc.filters_html).append(help_button)
+ let help_button_wrapper = frm.get_field("conditions_and_formula_variable_and_example").$wrapper;
+ help_button_wrapper.empty();
+ help_button_wrapper.append(frm.doc.filters_html).append(help_button)
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet)
diff --git a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
index 3bad587..8a79416 100644
--- a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
+++ b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
@@ -6,8 +6,8 @@
from frappe import _
def execute(filters=None):
- columns = get_columns(filters)
data = get_data(filters)
+ columns = get_columns(filters) if len(data) else []
return columns, data
@@ -78,8 +78,11 @@
if filters.get("company"):
conditions.append("sal.company = '%s' " % (filters["company"]) )
- if filters.get("period"):
- conditions.append("month(sal.start_date) = '%s' " % (filters["period"]))
+ if filters.get("month"):
+ conditions.append("month(sal.start_date) = '%s' " % (filters["month"]))
+
+ if filters.get("year"):
+ conditions.append("year(start_date) = '%s' " % (filters["year"]))
return " and ".join(conditions)
@@ -96,6 +99,9 @@
component_types = [comp_type[0] for comp_type in component_types]
+ if not len(component_types):
+ return []
+
conditions = get_conditions(filters)
entry = frappe.db.sql(""" select sal.employee, sal.employee_name, sal.posting_date, ded.salary_component, ded.amount,sal.gross_pay
diff --git a/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py b/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
index 073bd91..d09745c 100644
--- a/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
+++ b/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
@@ -84,9 +84,11 @@
if filters.get("company"):
conditions.append("company = '%s' " % (filters["company"]) )
- if filters.get("period"):
- conditions.append("month(start_date) = '%s' " % (filters["period"]))
- conditions.append("year(start_date) = '%s' " % (frappe.utils.getdate().year))
+ if filters.get("month"):
+ conditions.append("month(start_date) = '%s' " % (filters["month"]))
+
+ if filters.get("year"):
+ conditions.append("year(start_date) = '%s' " % (filters["year"]))
return " and ".join(conditions)
diff --git a/erpnext/public/js/salary_slip_deductions_report_filters.js b/erpnext/public/js/salary_slip_deductions_report_filters.js
index 2420379..2b30e65 100644
--- a/erpnext/public/js/salary_slip_deductions_report_filters.js
+++ b/erpnext/public/js/salary_slip_deductions_report_filters.js
@@ -11,8 +11,8 @@
default: frappe.defaults.get_user_default("Company"),
},
{
- fieldname: "period",
- label: __("Period"),
+ fieldname: "month",
+ label: __("Month"),
fieldtype: "Select",
reqd: 1 ,
options: [
@@ -32,6 +32,12 @@
default: frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth() + 1
},
{
+ fieldname:"year",
+ label: __("Year"),
+ fieldtype: "Select",
+ reqd: 1
+ },
+ {
fieldname: "department",
label: __("Department"),
fieldtype: "Link",
@@ -43,5 +49,18 @@
fieldtype: "Link",
options: "Branch",
}
- ]
+ ],
+
+ "onload": function() {
+ return frappe.call({
+ method: "erpnext.regional.report.provident_fund_deductions.provident_fund_deductions.get_years",
+ callback: function(r) {
+ var year_filter = frappe.query_report.get_filter('year');
+ year_filter.df.options = r.message;
+ year_filter.df.default = r.message.split("\n")[0];
+ year_filter.refresh();
+ year_filter.set_input(year_filter.df.default);
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
index 900fe96..acde68a 100644
--- a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
+++ b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
@@ -7,8 +7,8 @@
from erpnext.regional.report.provident_fund_deductions.provident_fund_deductions import get_conditions
def execute(filters=None):
- columns = get_columns(filters)
data = get_data(filters)
+ columns = get_columns(filters) if len(data) else []
return columns, data
@@ -45,6 +45,9 @@
component_type_dict = frappe._dict(frappe.db.sql(""" select name, component_type from `tabSalary Component`
where component_type = 'Professional Tax' """))
+ if not len(component_type_dict):
+ return []
+
conditions = get_conditions(filters)
entry = frappe.db.sql(""" select sal.employee, sal.employee_name, ded.salary_component, ded.amount
diff --git a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
index 9f58957..084890e 100644
--- a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
+++ b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
@@ -3,11 +3,12 @@
from __future__ import unicode_literals
import frappe
+from frappe.utils import getdate
from frappe import _
def execute(filters=None):
- columns = get_columns(filters)
data = get_data(filters)
+ columns = get_columns(filters) if len(data) else []
return columns, data
@@ -71,10 +72,13 @@
conditions.append("sal.branch = '%s' " % (filters["branch"]) )
if filters.get("company"):
- conditions.append("sal.company = '%s' " % (filters["company"]) )
+ conditions.append("sal.company = '%s' " % (filters["company"]))
- if filters.get("period"):
- conditions.append("month(sal.start_date) = '%s' " % (filters["period"]))
+ if filters.get("month"):
+ conditions.append("month(sal.start_date) = '%s' " % (filters["month"]))
+
+ if filters.get("year"):
+ conditions.append("year(start_date) = '%s' " % (filters["year"]))
if filters.get("mode_of_payment"):
conditions.append("sal.mode_of_payment = '%s' " % (filters["mode_of_payment"]))
@@ -114,6 +118,9 @@
component_type_dict = frappe._dict(frappe.db.sql(""" select name, component_type from `tabSalary Component`
where component_type in ('Provident Fund', 'Additional Provident Fund', 'Provident Fund Loan')"""))
+ if not len(component_type_dict):
+ return []
+
entry = frappe.db.sql(""" select sal.name, sal.employee, sal.employee_name, ded.salary_component, ded.amount
from `tabSalary Slip` sal, `tabSalary Detail` ded
where sal.name = ded.parent
@@ -150,4 +157,12 @@
data.append(employee)
- return data
\ No newline at end of file
+ return data
+
+@frappe.whitelist()
+def get_years():
+ year_list = frappe.db.sql_list("""select distinct YEAR(end_date) from `tabSalary Slip` ORDER BY YEAR(end_date) DESC""")
+ if not year_list:
+ year_list = [getdate().year]
+
+ return "\n".join(str(year) for year in year_list)
\ No newline at end of file