cleaned up leave application

This commit is contained in:
Rushabh Mehta
2012-11-30 12:41:46 +05:30
parent 86adcaa113
commit 71d6a0ce1d
7 changed files with 301 additions and 355 deletions

View File

@@ -1,6 +1,8 @@
erpnext.updates = [ erpnext.updates = [
["30th November 2012", [ ["30th November 2012", [
"Auto Notifications: System will prompt user with pre-set message for auto-notification.", "Auto Notifications: System will prompt user with pre-set message for auto-notification.",
"Employee: Users with role Employee will only be able to see their Employee Records.",
"Leave Application: Users with role Employee can now apply for leaves. HR User will be able to set Approval or Rejection.",
]], ]],
["29th November 2012", [ ["29th November 2012", [
"EMail: Form Emails are now via Communication (with Rich Text Etc.).", "EMail: Form Emails are now via Communication (with Rich Text Etc.).",

View File

@@ -14,39 +14,49 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// ****************************************** onload ********************************************************
cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
} }
cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.set_intro("");
if(doc.__islocal && !in_list(user_roles, "HR User")) {
cur_frm.set_intro("Fill the form and save it")
} else {
if(in_list(user_roles, "HR User")) {
if(doc.status=="Open") {
cur_frm.set_intro("Please Approve (and Submit) or Reject, or re-assign to applicant for further review.");
}
} else {
if(doc.status=="Open") {
cur_frm.set_intro("Leave application is pending approval.");
} else if(doc.status=="Approved") {
cur_frm.set_intro("Leave application has been approved.");
} else if(doc.status=="Rejected") {
cur_frm.set_intro("Leave application has been rejected.");
}
}
}
if(doc.status=="Approved" && doc.docstatus!=1) {
cur_frm.savesubmit()
}
}
// ************************************** client triggers ***************************************************
// ---------
// employee
// ---------
cur_frm.add_fetch('employee','employee_name','employee_name'); cur_frm.add_fetch('employee','employee_name','employee_name');
cur_frm.cscript.employee = function (doc, dt, dn){ cur_frm.cscript.employee = function (doc, dt, dn){
get_leave_balance(doc, dt, dn); get_leave_balance(doc, dt, dn);
} }
// ------------
// fiscal_year
// ------------
cur_frm.cscript.fiscal_year = function (doc, dt, dn){ cur_frm.cscript.fiscal_year = function (doc, dt, dn){
get_leave_balance(doc, dt, dn); get_leave_balance(doc, dt, dn);
} }
// -----------
// leave type
// -----------
cur_frm.cscript.leave_type = function (doc, dt, dn){ cur_frm.cscript.leave_type = function (doc, dt, dn){
get_leave_balance(doc, dt, dn); get_leave_balance(doc, dt, dn);
} }
// ---------
// half day
// ---------
cur_frm.cscript.half_day = function(doc, dt, dn) { cur_frm.cscript.half_day = function(doc, dt, dn) {
if(doc.from_date) { if(doc.from_date) {
set_multiple(dt,dn,{to_date:doc.from_date}); set_multiple(dt,dn,{to_date:doc.from_date});
@@ -54,9 +64,6 @@ cur_frm.cscript.half_day = function(doc, dt, dn) {
} }
} }
// ---------
// from date
// ---------
cur_frm.cscript.from_date = function(doc, dt, dn) { cur_frm.cscript.from_date = function(doc, dt, dn) {
if(cint(doc.half_day) == 1){ if(cint(doc.half_day) == 1){
set_multiple(dt,dn,{to_date:doc.from_date}); set_multiple(dt,dn,{to_date:doc.from_date});
@@ -64,9 +71,6 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
calculate_total_days(doc, dt, dn); calculate_total_days(doc, dt, dn);
} }
// --------
// to date
// --------
cur_frm.cscript.to_date = function(doc, dt, dn) { cur_frm.cscript.to_date = function(doc, dt, dn) {
if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){ if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
msgprint("To Date should be same as From Date for Half Day leave"); msgprint("To Date should be same as From Date for Half Day leave");
@@ -75,20 +79,11 @@ cur_frm.cscript.to_date = function(doc, dt, dn) {
calculate_total_days(doc, dt, dn); calculate_total_days(doc, dt, dn);
} }
// ******************************************* utilities ****************************************************
// ------------------
// get leave balance
// ------------------
get_leave_balance = function(doc, dt, dn) { get_leave_balance = function(doc, dt, dn) {
if(doc.employee && doc.leave_type && doc.fiscal_year) if(doc.employee && doc.leave_type && doc.fiscal_year)
get_server_fields('get_leave_balance', '','', doc, dt, dn, 1); get_server_fields('get_leave_balance', '','', doc, dt, dn, 1);
} }
// ---------------
// calculate days
// ---------------
calculate_total_days = function(doc, dt, dn) { calculate_total_days = function(doc, dt, dn) {
if(doc.from_date && doc.to_date){ if(doc.from_date && doc.to_date){
if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5}); if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});

View File

@@ -38,12 +38,6 @@ class DocType:
self.doc = doc self.doc = doc
self.doclist = doclist self.doclist = doclist
# ******************************************** client triggers ***********************************************
# ------------------
# get leave balance
# ------------------
def get_leave_balance(self): def get_leave_balance(self):
leave_all = sql("select total_leaves_allocated from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year)) leave_all = sql("select total_leaves_allocated from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
leave_all = leave_all and flt(leave_all[0][0]) or 0 leave_all = leave_all and flt(leave_all[0][0]) or 0
@@ -52,10 +46,6 @@ class DocType:
ret = {'leave_balance':leave_all - leave_app} ret = {'leave_balance':leave_all - leave_app}
return ret return ret
# ************************************************ utilities *************************************************
# -------------------
def get_holidays(self): def get_holidays(self):
""" """
get total holidays get total holidays
@@ -65,10 +55,6 @@ class DocType:
tot_hol = sql("select count(*) from `tabHoliday` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between '%s' and '%s' and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s"% (self.doc.from_date, self.doc.to_date, self.doc.fiscal_year)) tot_hol = sql("select count(*) from `tabHoliday` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between '%s' and '%s' and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s"% (self.doc.from_date, self.doc.to_date, self.doc.fiscal_year))
return tot_hol and flt(tot_hol[0][0]) or 0 return tot_hol and flt(tot_hol[0][0]) or 0
# ---------------------
# get total leave days
# ---------------------
def get_total_leave_days(self): def get_total_leave_days(self):
""" """
Calculates total leave days based on input and holidays Calculates total leave days based on input and holidays
@@ -82,27 +68,15 @@ class DocType:
} }
return ret return ret
# ************************************************ validate *************************************************
# -----------------
# validate to date
# -----------------
def validate_to_date(self): def validate_to_date(self):
if self.doc.from_date and self.doc.to_date and (getdate(self.doc.to_date) < getdate(self.doc.from_date)): if self.doc.from_date and self.doc.to_date and (getdate(self.doc.to_date) < getdate(self.doc.from_date)):
msgprint("To date cannot be before from date") msgprint("To date cannot be before from date")
raise Exception raise Exception
# --------------------------------
# check whether leave type is lwp
# --------------------------------
def is_lwp(self): def is_lwp(self):
lwp = sql("select is_lwp from `tabLeave Type` where name = %s", self.doc.leave_type) lwp = sql("select is_lwp from `tabLeave Type` where name = %s", self.doc.leave_type)
return lwp and cint(lwp[0][0]) or 0 return lwp and cint(lwp[0][0]) or 0
# ------------------------
# validate balance leaves
# ------------------------
def validate_balance_leaves(self): def validate_balance_leaves(self):
if self.doc.from_date and self.doc.to_date and not self.is_lwp(): if self.doc.from_date and self.doc.to_date and not self.is_lwp():
bal = self.get_leave_balance() bal = self.get_leave_balance()
@@ -111,12 +85,8 @@ class DocType:
set(self.doc,'leave_balance',flt(bal['leave_balance'])) set(self.doc,'leave_balance',flt(bal['leave_balance']))
set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days'])) set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']): if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']):
msgprint("Employee : %s cannot apply for %s of more than %s days" % (self.doc.employee, self.doc.leave_type, flt(bal['leave_balance']))) msgprint("Warning : There is not enough leave balance")
raise Exception
#
# validate overlapping leaves
#
def validate_leave_overlap(self): def validate_leave_overlap(self):
for d in sql("""select name, leave_type, posting_date, from_date, to_date for d in sql("""select name, leave_type, posting_date, from_date, to_date
from `tabLeave Application` from `tabLeave Application`
@@ -128,9 +98,6 @@ class DocType:
msgprint("Employee : %s has already applied for %s between %s and %s on %s. Please refer Leave Application : %s" % (self.doc.employee, cstr(d['leave_type']), formatdate(d['from_date']), formatdate(d['to_date']), formatdate(d['posting_date']), d['name']), raise_exception = 1) msgprint("Employee : %s has already applied for %s between %s and %s on %s. Please refer Leave Application : %s" % (self.doc.employee, cstr(d['leave_type']), formatdate(d['from_date']), formatdate(d['to_date']), formatdate(d['posting_date']), d['name']), raise_exception = 1)
# ---------------------------------------------------------------------
# validate max days for which leave can be applied for particular type
# ---------------------------------------------------------------------
def validate_max_days(self): def validate_max_days(self):
max_days = sql("select max_days_allowed from `tabLeave Type` where name = '%s'" %(self.doc.leave_type)) max_days = sql("select max_days_allowed from `tabLeave Type` where name = '%s'" %(self.doc.leave_type))
max_days = max_days and flt(max_days[0][0]) or 0 max_days = max_days and flt(max_days[0][0]) or 0
@@ -138,12 +105,13 @@ class DocType:
msgprint("Sorry ! You cannot apply for %s for more than %s days" % (self.doc.leave_type, max_days)) msgprint("Sorry ! You cannot apply for %s for more than %s days" % (self.doc.leave_type, max_days))
raise Exception raise Exception
# ---------
# validate
# ---------
def validate(self): def validate(self):
self.validate_to_date() self.validate_to_date()
self.validate_balance_leaves() self.validate_balance_leaves()
self.validate_leave_overlap() self.validate_leave_overlap()
self.validate_max_days() self.validate_max_days()
def on_submit(self):
if self.doc.status != "Approved":
webnotes.msgprint("""Only Approved Leave Applications can be Submitted.""",
raise_exception=True)

View File

@@ -1,285 +1,239 @@
# DocType, Leave Application
[ [
{
# These values are common in all dictionaries "owner": "Administrator",
{ "docstatus": 0,
u'creation': '2012-05-15 12:14:45', "creation": "2012-11-02 17:16:54",
u'docstatus': 0, "modified_by": "Administrator",
u'modified': '2012-10-02 11:19:44', "modified": "2012-11-30 12:17:27"
u'modified_by': u'Administrator', },
u'owner': u'Administrator' {
}, "is_submittable": 1,
"autoname": "LAP/.#####",
# These values are common for all DocType "name": "__common__",
{ "search_fields": "employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year",
'_last_update': u'1310019491', "module": "HR",
'autoname': u'LAP/.#####', "doctype": "DocType",
'colour': u'White:FFF', "document_type": "Transaction"
u'doctype': u'DocType', },
'document_type': u'Transaction', {
'is_submittable': 1, "name": "__common__",
'module': u'HR', "parent": "Leave Application",
u'name': u'__common__', "doctype": "DocField",
'search_fields': u'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year', "parenttype": "DocType",
'section_style': u'Simple', "parentfield": "fields"
'show_in_menu': 0, },
'subject': u'From %(employee_name)s, %(designation)s', {
'tag_fields': u'leave_type', "name": "__common__",
'version': 1 "parent": "Leave Application",
}, "read": 1,
"doctype": "DocPerm",
# These values are common for all DocField "parenttype": "DocType",
{ "parentfield": "permissions"
u'doctype': u'DocField', },
u'name': u'__common__', {
'parent': u'Leave Application', "name": "Leave Application",
'parentfield': u'fields', "doctype": "DocType"
'parenttype': u'DocType' },
}, {
"default": "Open",
# These values are common for all DocPerm "colour": "White:FFF",
{ "doctype": "DocField",
u'doctype': u'DocPerm', "label": "Status",
u'name': u'__common__', "options": "Open\nApproved\nRejected",
'parent': u'Leave Application', "fieldname": "status",
'parentfield': u'permissions', "fieldtype": "Select",
'parenttype': u'DocType', "permlevel": 3
'read': 1 },
}, {
"search_index": 1,
# DocType, Leave Application "doctype": "DocField",
{ "label": "Leave Type",
u'doctype': u'DocType', "options": "link:Leave Type",
u'name': u'Leave Application' "fieldname": "leave_type",
}, "fieldtype": "Select",
"reqd": 1,
# DocField "permlevel": 0,
{ "in_filter": 1
u'doctype': u'DocField', },
'fieldname': u'column_break0', {
'fieldtype': u'Column Break', "search_index": 1,
'permlevel': 0, "colour": "White:FFF",
'width': u'50%' "doctype": "DocField",
}, "label": "From Date",
"trigger": "Client",
# DocField "fieldname": "from_date",
{ "fieldtype": "Date",
u'doctype': u'DocField', "reqd": 1,
'fieldname': u'employee', "permlevel": 0
'fieldtype': u'Link', },
'in_filter': 1, {
'label': u'Employee', "search_index": 1,
'options': u'Employee', "colour": "White:FFF",
'permlevel': 0, "doctype": "DocField",
'reqd': 1, "label": "To Date",
'search_index': 1 "trigger": "Client",
}, "fieldname": "to_date",
"fieldtype": "Date",
# DocField "reqd": 1,
{ "permlevel": 0
u'doctype': u'DocField', },
'fieldname': u'employee_name', {
'fieldtype': u'Data', "colour": "White:FFF",
'in_filter': 1, "doctype": "DocField",
'label': u'Employee Name', "label": "Half Day",
'permlevel': 1, "trigger": "Client",
'search_index': 0 "fieldname": "half_day",
}, "fieldtype": "Check",
"permlevel": 0
# DocField },
{ {
u'doctype': u'DocField', "doctype": "DocField",
'fieldname': u'leave_type', "width": "50%",
'fieldtype': u'Select', "fieldname": "column_break1",
'in_filter': 1, "fieldtype": "Column Break",
'label': u'Leave Type', "permlevel": 0
'options': u'link:Leave Type', },
'permlevel': 0, {
'reqd': 1, "doctype": "DocField",
'search_index': 1 "label": "Leave Balance",
}, "fieldname": "leave_balance",
"fieldtype": "Currency",
# DocField "permlevel": 1
{ },
u'doctype': u'DocField', {
'fieldname': u'leave_balance', "doctype": "DocField",
'fieldtype': u'Currency', "label": "Total Leave Days",
'label': u'Leave Balance', "fieldname": "total_leave_days",
'permlevel': 1 "fieldtype": "Currency",
}, "permlevel": 1
},
# DocField {
{ "search_index": 1,
'colour': u'White:FFF', "doctype": "DocField",
'default': u'Today', "label": "Employee",
u'doctype': u'DocField', "options": "Employee",
'fieldname': u'posting_date', "fieldname": "employee",
'fieldtype': u'Date', "fieldtype": "Link",
'label': u'Posting Date', "reqd": 1,
'no_copy': 1, "permlevel": 0,
'permlevel': 1, "in_filter": 1
'reqd': 1 },
}, {
"search_index": 0,
# DocField "doctype": "DocField",
{ "label": "Employee Name",
u'doctype': u'DocField', "fieldname": "employee_name",
'fieldname': u'fiscal_year', "fieldtype": "Data",
'fieldtype': u'Select', "permlevel": 1,
'in_filter': 1, "in_filter": 1
'label': u'Fiscal Year', },
'options': u'link:Fiscal Year', {
'permlevel': 0, "doctype": "DocField",
'reqd': 1, "fieldname": "sb10",
'search_index': 0 "fieldtype": "Section Break",
}, "permlevel": 0
},
# DocField {
{ "doctype": "DocField",
u'doctype': u'DocField', "label": "Reason",
'fieldname': u'column_break1', "width": "300px",
'fieldtype': u'Column Break', "fieldname": "description",
'permlevel': 0, "fieldtype": "Text Editor",
'width': u'50%' "permlevel": 0
}, },
{
# DocField "doctype": "DocField",
{ "label": "HR Details",
'colour': u'White:FFF', "fieldname": "sb12",
u'doctype': u'DocField', "fieldtype": "Section Break",
'fieldname': u'half_day', "permlevel": 2
'fieldtype': u'Check', },
'label': u'Half Day', {
'permlevel': 0, "default": "Today",
'trigger': u'Client' "colour": "White:FFF",
}, "doctype": "DocField",
"label": "Posting Date",
# DocField "no_copy": 1,
{ "fieldname": "posting_date",
'colour': u'White:FFF', "fieldtype": "Date",
u'doctype': u'DocField', "reqd": 1,
'fieldname': u'from_date', "permlevel": 2
'fieldtype': u'Date', },
'label': u'From Date', {
'permlevel': 0, "search_index": 0,
'search_index': 1, "doctype": "DocField",
'trigger': u'Client' "label": "Fiscal Year",
}, "options": "link:Fiscal Year",
"fieldname": "fiscal_year",
# DocField "fieldtype": "Select",
{ "reqd": 1,
'colour': u'White:FFF', "permlevel": 2,
u'doctype': u'DocField', "in_filter": 1
'fieldname': u'to_date', },
'fieldtype': u'Date', {
'label': u'To Date', "doctype": "DocField",
'permlevel': 0, "label": "Letter Head",
'search_index': 1, "options": "Letter Head",
'trigger': u'Client' "fieldname": "letter_head",
}, "fieldtype": "Link",
"permlevel": 2
# DocField },
{ {
u'doctype': u'DocField', "doctype": "DocField",
'fieldname': u'total_leave_days', "label": "Amended From",
'fieldtype': u'Currency', "fieldname": "amended_from",
'label': u'Total Leave Days', "fieldtype": "Data",
'permlevel': 1 "permlevel": 2
}, },
{
# DocField "doctype": "DocField",
{ "label": "Amendment Date",
u'doctype': u'DocField', "fieldname": "amendment_date",
'fieldname': u'description', "fieldtype": "Date",
'fieldtype': u'Small Text', "permlevel": 2
'label': u'Description', },
'permlevel': 0, {
'width': u'300px' "create": 1,
}, "doctype": "DocPerm",
"write": 1,
# DocField "role": "Employee",
{ "permlevel": 0,
u'doctype': u'DocField', "match": "employee"
'fieldname': u'letter_head', },
'fieldtype': u'Link', {
'label': u'Letter Head', "doctype": "DocPerm",
'options': u'Letter Head', "role": "All",
'permlevel': 0 "permlevel": 1
}, },
{
# DocField "amend": 1,
{ "create": 1,
u'doctype': u'DocField', "doctype": "DocPerm",
'fieldname': u'amended_from', "submit": 1,
'fieldtype': u'Data', "write": 1,
'label': u'Amended From', "role": "HR User",
'permlevel': 1 "cancel": 1,
}, "permlevel": 0
},
# DocField {
{ "amend": 0,
u'doctype': u'DocField', "create": 0,
'fieldname': u'amendment_date', "doctype": "DocPerm",
'fieldtype': u'Date', "submit": 0,
'label': u'Amendment Date', "write": 1,
'permlevel': 1 "role": "HR User",
}, "cancel": 0,
"permlevel": 2
# DocPerm },
{ {
'amend': 0, "doctype": "DocPerm",
'cancel': 0, "role": "All",
'create': 0, "permlevel": 3
u'doctype': u'DocPerm', },
'match': u'owner', {
'permlevel': 0, "doctype": "DocPerm",
'role': u'Employee', "write": 1,
'submit': 0, "role": "HR User",
'write': 0 "permlevel": 3
}, }
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'HR User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'HR Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'HR User'
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'HR Manager'
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Employee'
}
] ]

View File

@@ -3,6 +3,7 @@ wn.doclistviews['Leave Application'] = wn.views.ListView.extend({
init: function(d) { init: function(d) {
this._super(d) this._super(d)
this.fields = this.fields.concat([ this.fields = this.fields.concat([
"`tabLeave Application`.status",
"`tabLeave Application`.employee_name", "`tabLeave Application`.employee_name",
"`tabLeave Application`.total_leave_days", "`tabLeave Application`.total_leave_days",
"`tabLeave Application`.from_date", "`tabLeave Application`.from_date",
@@ -12,8 +13,21 @@ wn.doclistviews['Leave Application'] = wn.views.ListView.extend({
this.stats = this.stats.concat(['company']); this.stats = this.stats.concat(['company']);
}, },
label_style: {
"status": {
"Open": "danger",
"Approved": "success",
"Rejected": "info",
}
},
prepare_data: function(data) { prepare_data: function(data) {
this._super(data); this._super(data);
data.label_style = this.label_style.status[data.status];
data.status_html = repl('<span class="label \
label-%(label_style)s">%(status)s</span>', data);
data.from_date = wn.datetime.str_to_user(data.from_date); data.from_date = wn.datetime.str_to_user(data.from_date);
data.to_date = wn.datetime.str_to_user(data.to_date); data.to_date = wn.datetime.str_to_user(data.to_date);
data.date_range = (data.from_date === data.to_date) data.date_range = (data.from_date === data.to_date)
@@ -28,10 +42,10 @@ wn.doclistviews['Leave Application'] = wn.views.ListView.extend({
{width: '3%', content: 'check'}, {width: '3%', content: 'check'},
{width: '5%', content:'avatar'}, {width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'}, {width: '3%', content:'docstatus'},
{width: '15%', content:'status_html'},
{width: '12%', content:'name'}, {width: '12%', content:'name'},
{width: '37%', content:'employee_name+tags'}, {width: '25%', content:'employee_name+tags'},
{width: '10%', content:'total_leave_days', {width: '25%', content:'date_range'},
css: {'color':'#777'}}, {width: '12%', content:'modified'},
{width: '30%', content:'date_range'},
] ]
}); });

View File

@@ -0,0 +1,9 @@
import webnotes
def execute():
webnotes.clear_perms("Leave Application")
webnotes.reload_doc("hr", "doctype", "leave_application")
webnotes.conn.sql("""update `tabLeave Application` set status='Approved'
where docstatus=1""")
webnotes.conn.sql("""update `tabLeave Application` set status='Open'
where docstatus=0""")

View File

@@ -693,4 +693,8 @@ patch_list = [
'patch_module': 'patches.november_2012', 'patch_module': 'patches.november_2012',
'patch_file': 'add_employee_field_in_employee', 'patch_file': 'add_employee_field_in_employee',
}, },
{
'patch_module': 'patches.november_2012',
'patch_file': 'leave_application_cleanup',
},
] ]