Merge pull request #14039 from rohitwaghchaure/code_clanup_hr

Code cleaup
This commit is contained in:
rohitwaghchaure 2018-05-15 12:47:33 +05:30 committed by GitHub
commit 686d5f219e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,15 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
});
frappe.ui.form.on('Employee',{
setup: function(frm) {
frm.set_query("leave_policy", function() {
return {
"filters": {
"docstatus": 1
}
};
});
},
onload:function(frm) {
frm.set_query("department", function() {
return {

View File

@ -60,7 +60,6 @@ class LeavePeriod(Document):
frappe.throw(_("Employee {0} already have Leave Allocation {1} for this period").format(employee, leave_alloc[0][0])\
+ """ <b><a href="#Form/Leave Allocation/{0}">{0}</a></b>""".format(leave_alloc[0][0]))
def validate_dates(self):
if getdate(self.from_date) >= getdate(self.to_date):
frappe.throw(_("To date can not be equal or less than from date"))
@ -79,3 +78,4 @@ class LeavePeriod(Document):
allocation.carry_forward = self.carry_forward_leaves
allocation.save(ignore_permissions = True)
allocation.submit()
frappe.msgprint(_("Leave Allocation {0} created").format(allocation.name))