mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
Code cleaup
This commit is contained in:
@@ -37,6 +37,15 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
});
|
});
|
||||||
frappe.ui.form.on('Employee',{
|
frappe.ui.form.on('Employee',{
|
||||||
|
setup: function(frm) {
|
||||||
|
frm.set_query("leave_policy", function() {
|
||||||
|
return {
|
||||||
|
"filters": {
|
||||||
|
"docstatus": 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
onload:function(frm) {
|
onload:function(frm) {
|
||||||
frm.set_query("department", function() {
|
frm.set_query("department", function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -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])\
|
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]))
|
+ """ <b><a href="#Form/Leave Allocation/{0}">{0}</a></b>""".format(leave_alloc[0][0]))
|
||||||
|
|
||||||
|
|
||||||
def validate_dates(self):
|
def validate_dates(self):
|
||||||
if getdate(self.from_date) >= getdate(self.to_date):
|
if getdate(self.from_date) >= getdate(self.to_date):
|
||||||
frappe.throw(_("To date can not be equal or less than from 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.carry_forward = self.carry_forward_leaves
|
||||||
allocation.save(ignore_permissions = True)
|
allocation.save(ignore_permissions = True)
|
||||||
allocation.submit()
|
allocation.submit()
|
||||||
|
frappe.msgprint(_("Leave Allocation {0} created").format(allocation.name))
|
||||||
|
|||||||
Reference in New Issue
Block a user