Merge branch 'develop' into shift_management

This commit is contained in:
Marica
2020-08-17 13:46:51 +05:30
committed by GitHub
10 changed files with 155 additions and 38 deletions

View File

@@ -24,8 +24,13 @@ class JobOffer(Document):
check_vacancies = frappe.get_single("HR Settings").check_vacancies
if staffing_plan and check_vacancies:
job_offers = self.get_job_offer(staffing_plan.from_date, staffing_plan.to_date)
if staffing_plan.vacancies - len(job_offers) <= 0:
frappe.throw(_("There are no vacancies under staffing plan {0}").format(frappe.bold(get_link_to_form("Staffing Plan", staffing_plan.parent))))
if not staffing_plan.get("vacancies") or staffing_plan.vacancies - len(job_offers) <= 0:
error_variable = 'for ' + frappe.bold(self.designation)
if staffing_plan.get("parent"):
error_variable = frappe.bold(get_link_to_form("Staffing Plan", staffing_plan.parent))
frappe.throw(_("There are no vacancies under staffing plan {0}").format(error_variable))
def on_change(self):
update_job_applicant(self.status, self.job_applicant)

View File

@@ -5,20 +5,23 @@ cur_frm.add_fetch('employee','employee_name','employee_name');
frappe.ui.form.on("Leave Allocation", {
onload: function(frm) {
// Ignore cancellation of doctype on cancel all.
frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"];
if(!frm.doc.from_date) frm.set_value("from_date", frappe.datetime.get_today());
frm.set_query("employee", function() {
return {
query: "erpnext.controllers.queries.employee_query"
}
};
});
frm.set_query("leave_type", function() {
return {
filters: {
is_lwp: 0
}
}
})
};
});
},
refresh: function(frm) {

View File

@@ -19,6 +19,10 @@ frappe.ui.form.on("Leave Application", {
frm.set_query("employee", erpnext.queries.employee);
},
onload: function(frm) {
// Ignore cancellation of doctype on cancel all.
frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"];
if (!frm.doc.posting_date) {
frm.set_value("posting_date", frappe.datetime.get_today());
}

View File

@@ -2,6 +2,10 @@
// For license information, please see license.txt
frappe.ui.form.on('Leave Encashment', {
onload: function(frm) {
// Ignore cancellation of doctype on cancel all.
frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"];
},
setup: function(frm) {
frm.set_query("leave_type", function() {
return {
@@ -33,7 +37,7 @@ frappe.ui.form.on('Leave Encashment', {
doc: frm.doc,
callback: function(r) {
frm.refresh_fields();
}
}
});
}
}