From c0ebaae15aae025abcbd2dd48da7dd0f038c904f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 17:42:01 +0530 Subject: [PATCH] [fix][hr] fetch emp name in attendance and default value --- hr/doctype/attendance/attendance.js | 9 ++++----- hr/doctype/attendance/attendance.py | 6 ------ hr/doctype/attendance/attendance.txt | 18 +++++++++++------- hr/page/hr_home/hr_home.js | 22 +++++++++++----------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/hr/doctype/attendance/attendance.js b/hr/doctype/attendance/attendance.js index 3ba986891b..1749a6cb26 100644 --- a/hr/doctype/attendance/attendance.js +++ b/hr/doctype/attendance/attendance.js @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.add_fetch('employee', 'company', 'company'); +cur_frm.add_fetch('employee', 'company', 'company'); +cur_frm.add_fetch('employee', 'employee_name', 'employee_name'); -//get employee's name based on employee id selected -cur_frm.cscript.employee = function(doc,cdt,cdn){ - if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1); - refresh_field('employee_name'); +cur_frm.cscript.onload = function(doc, cdt, cdn) { + if(doc.__islocal) cur_frm.set_value("att_date", get_today()); } cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file diff --git a/hr/doctype/attendance/attendance.py b/hr/doctype/attendance/attendance.py index ac41acf815..16e25470b0 100644 --- a/hr/doctype/attendance/attendance.py +++ b/hr/doctype/attendance/attendance.py @@ -26,12 +26,6 @@ class DocType: def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist - - def get_emp_name(self): - return { - "employee_name": webnotes.conn.get_value("Employee", - self.doc.employee_name, "employee_name") - } def validate_duplicate_record(self): res = sql("""select name from `tabAttendance` where employee = %s and att_date = %s diff --git a/hr/doctype/attendance/attendance.txt b/hr/doctype/attendance/attendance.txt index aa917ed7bd..d948d6fba1 100644 --- a/hr/doctype/attendance/attendance.txt +++ b/hr/doctype/attendance/attendance.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:13", "docstatus": 0, - "modified": "2013-07-05 14:25:19", + "modified": "2013-07-10 17:39:22", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -25,6 +25,7 @@ "permlevel": 0 }, { + "cancel": 1, "create": 1, "doctype": "DocPerm", "name": "__common__", @@ -33,6 +34,8 @@ "parenttype": "DocType", "permlevel": 0, "read": 1, + "report": 1, + "submit": 1, "write": 1 }, { @@ -80,6 +83,7 @@ "oldfieldtype": "Data" }, { + "default": "Present", "doctype": "DocField", "fieldname": "status", "fieldtype": "Select", @@ -157,15 +161,15 @@ "read_only": 1 }, { - "cancel": 1, "doctype": "DocPerm", - "report": 1, - "role": "HR User", - "submit": 1 + "role": "System Manager" + }, + { + "doctype": "DocPerm", + "role": "HR User" }, { "doctype": "DocPerm", - "match": "owner", - "role": "Employee" + "role": "HR Manager" } ] \ No newline at end of file diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js index 517fb772c4..dadc6fb02f 100644 --- a/hr/page/hr_home/hr_home.js +++ b/hr/page/hr_home/hr_home.js @@ -23,9 +23,14 @@ wn.module_page["HR"] = [ doctype:"Expense Claim" }, { - label: wn._("Job Applicant"), - description: wn._("Applicant for a Job."), - doctype:"Job Applicant" + label: wn._("Salary Slip"), + description: wn._("Monthly salary statement."), + doctype:"Salary Slip" + }, + { + label: wn._("Attendance"), + description: wn._("Attendance record."), + doctype:"Attendance" }, ] }, @@ -34,14 +39,9 @@ wn.module_page["HR"] = [ icon: "icon-copy", items: [ { - label: wn._("Attendance"), - description: wn._("Attendance record."), - doctype:"Attendance" - }, - { - label: wn._("Salary Slip"), - description: wn._("Monthly salary statement."), - doctype:"Salary Slip" + label: wn._("Job Applicant"), + description: wn._("Applicant for a Job."), + doctype:"Job Applicant" }, { label: wn._("Appraisal"),