Browse Source

[fix][hr] fetch emp name in attendance and default value

develop
Nabin Hait 11 years ago
parent
commit
c0ebaae15a
  1. 9
      hr/doctype/attendance/attendance.js
  2. 6
      hr/doctype/attendance/attendance.py
  3. 18
      hr/doctype/attendance/attendance.txt
  4. 22
      hr/page/hr_home/hr_home.js

9
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 <http://www.gnu.org/licenses/>.
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;

6
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

18
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"
}
]

22
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"),

Loading…
Cancel
Save