From 7a4e739d6c4931b9df45d50aa64edcfc55224ca3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 5 Aug 2014 17:04:46 +0530 Subject: [PATCH] templating for hr --- erpnext/config/hr.py | 12 +++---- erpnext/hr/doctype/attendance/attendance.json | 5 +-- .../doctype/attendance/attendance_list.html | 19 ++++++++++ .../hr/doctype/attendance/attendance_list.js | 3 ++ .../hr/doctype/attendance/test_attendance.py | 10 ++++++ .../hr/doctype/attendance/test_records.json | 6 ++++ .../hr/doctype/employee/employee_list.html | 35 +++++++++++++++++++ erpnext/hr/doctype/employee/employee_list.js | 4 +++ .../expense_claim/expense_claim_list.html | 23 ++++++++++++ .../expense_claim/expense_claim_list.js | 4 +++ .../leave_application_list.html | 28 +++++++++++++++ .../leave_application_list.js | 4 +++ .../doctype/salary_slip/salary_slip_list.html | 26 ++++++++++++++ .../doctype/salary_slip/salary_slip_list.js | 3 ++ .../salary_structure/salary_structure.json | 5 +-- .../salary_structure/test_records.json | 6 ++++ .../salary_structure/test_salary_structure.py | 10 ++++++ erpnext/projects/doctype/project/project.js | 4 +-- .../maintenance_visit_list.html | 35 +++++++++++++++++++ .../maintenance_visit_list.js | 3 ++ erpnext/utilities/doctype/note/note_list.html | 16 +++++++++ erpnext/utilities/doctype/note/note_list.js | 1 + 22 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 erpnext/hr/doctype/attendance/attendance_list.html create mode 100644 erpnext/hr/doctype/attendance/attendance_list.js create mode 100644 erpnext/hr/doctype/attendance/test_attendance.py create mode 100644 erpnext/hr/doctype/attendance/test_records.json create mode 100644 erpnext/hr/doctype/employee/employee_list.html create mode 100644 erpnext/hr/doctype/employee/employee_list.js create mode 100644 erpnext/hr/doctype/expense_claim/expense_claim_list.html create mode 100644 erpnext/hr/doctype/expense_claim/expense_claim_list.js create mode 100644 erpnext/hr/doctype/leave_application/leave_application_list.html create mode 100644 erpnext/hr/doctype/leave_application/leave_application_list.js create mode 100644 erpnext/hr/doctype/salary_slip/salary_slip_list.html create mode 100644 erpnext/hr/doctype/salary_slip/salary_slip_list.js create mode 100644 erpnext/hr/doctype/salary_structure/test_records.json create mode 100644 erpnext/hr/doctype/salary_structure/test_salary_structure.py create mode 100644 erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html create mode 100644 erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js create mode 100644 erpnext/utilities/doctype/note/note_list.html diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py index 1fac46940e..575de697ee 100644 --- a/erpnext/config/hr.py +++ b/erpnext/config/hr.py @@ -13,13 +13,13 @@ def get_data(): }, { "type": "doctype", - "name": "Salary Slip", - "description": _("Monthly salary statement."), + "name": "Leave Application", + "description": _("Applications for leave."), }, { "type": "doctype", - "name": "Leave Application", - "description": _("Applications for leave."), + "name": "Expense Claim", + "description": _("Claims for company expense."), }, { "type": "doctype", @@ -28,8 +28,8 @@ def get_data(): }, { "type": "doctype", - "name": "Expense Claim", - "description": _("Claims for company expense."), + "name": "Salary Slip", + "description": _("Monthly salary statement."), }, { "type": "doctype", diff --git a/erpnext/hr/doctype/attendance/attendance.json b/erpnext/hr/doctype/attendance/attendance.json index 2ca5b33172..18c39e0c63 100644 --- a/erpnext/hr/doctype/attendance/attendance.json +++ b/erpnext/hr/doctype/attendance/attendance.json @@ -129,7 +129,7 @@ "icon": "icon-ok", "idx": 1, "is_submittable": 1, - "modified": "2014-05-27 03:49:07.580876", + "modified": "2014-08-05 06:52:02.226904", "modified_by": "Administrator", "module": "HR", "name": "Attendance", @@ -178,5 +178,6 @@ ], "search_fields": "employee, employee_name, att_date, status", "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "title_field": "employee_name" } \ No newline at end of file diff --git a/erpnext/hr/doctype/attendance/attendance_list.html b/erpnext/hr/doctype/attendance/attendance_list.html new file mode 100644 index 0000000000..bfda7f88e9 --- /dev/null +++ b/erpnext/hr/doctype/attendance/attendance_list.html @@ -0,0 +1,19 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + + {%= doc.status %} + +
+
+
+ + {%= doc.get_formatted("att_date") %} +
+
diff --git a/erpnext/hr/doctype/attendance/attendance_list.js b/erpnext/hr/doctype/attendance/attendance_list.js new file mode 100644 index 0000000000..87c87d76d3 --- /dev/null +++ b/erpnext/hr/doctype/attendance/attendance_list.js @@ -0,0 +1,3 @@ +frappe.listview_settings['Attendance'] = { + add_fields: ["status", "att_date"], +}; diff --git a/erpnext/hr/doctype/attendance/test_attendance.py b/erpnext/hr/doctype/attendance/test_attendance.py new file mode 100644 index 0000000000..e4f390b0e6 --- /dev/null +++ b/erpnext/hr/doctype/attendance/test_attendance.py @@ -0,0 +1,10 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_records = frappe.get_test_records('Attendance') + +class TestAttendance(unittest.TestCase): + pass diff --git a/erpnext/hr/doctype/attendance/test_records.json b/erpnext/hr/doctype/attendance/test_records.json new file mode 100644 index 0000000000..ccb77bfdc3 --- /dev/null +++ b/erpnext/hr/doctype/attendance/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Attendance", + "name": "_Test Attendance 1" + } +] diff --git a/erpnext/hr/doctype/employee/employee_list.html b/erpnext/hr/doctype/employee/employee_list.html new file mode 100644 index 0000000000..98b45a9c34 --- /dev/null +++ b/erpnext/hr/doctype/employee/employee_list.html @@ -0,0 +1,35 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + {% if(doc.status==="Active") { %} + + + + {% } %} + + {% if(doc.designation) { %} + + {%= doc.designation %} + {% } %} + + {% if(doc.branch) { %} + + {%= doc.branch %} + + {% } %} + + {% if(doc.department) { %} + + {%= doc.department %} + + {% } %} +
+
+
diff --git a/erpnext/hr/doctype/employee/employee_list.js b/erpnext/hr/doctype/employee/employee_list.js new file mode 100644 index 0000000000..c1b23ac43a --- /dev/null +++ b/erpnext/hr/doctype/employee/employee_list.js @@ -0,0 +1,4 @@ +frappe.listview_settings['Employee'] = { + add_fields: ["status", "branch", "department", "designation"], + filters:[["status","=", "Active"]] +}; diff --git a/erpnext/hr/doctype/expense_claim/expense_claim_list.html b/erpnext/hr/doctype/expense_claim/expense_claim_list.html new file mode 100644 index 0000000000..dd3c78fc66 --- /dev/null +++ b/erpnext/hr/doctype/expense_claim/expense_claim_list.html @@ -0,0 +1,23 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + + {%= doc.employee_name %} + + + {%= doc.approval_status %} + + +
+
+ +
+ {%= doc.get_formatted("total_claimed_amount") %} +
+
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim_list.js b/erpnext/hr/doctype/expense_claim/expense_claim_list.js new file mode 100644 index 0000000000..34ee5c14fb --- /dev/null +++ b/erpnext/hr/doctype/expense_claim/expense_claim_list.js @@ -0,0 +1,4 @@ +frappe.listview_settings['Expense Claim'] = { + add_fields: ["approval_status", "employee", "employee_name", "total_claimed_amount"], + filters:[["approval_status","!=", "Rejected"]] +}; diff --git a/erpnext/hr/doctype/leave_application/leave_application_list.html b/erpnext/hr/doctype/leave_application/leave_application_list.html new file mode 100644 index 0000000000..dfae4365b5 --- /dev/null +++ b/erpnext/hr/doctype/leave_application/leave_application_list.html @@ -0,0 +1,28 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + + {%= doc.employee_name %} + + + {%= __("{0} days from {1}", + [doc.total_leave_days, doc.get_formatted("from_date")]) %} + + + {%= doc.status %} + + + + {%= doc.leave_type %} + +
+
+
diff --git a/erpnext/hr/doctype/leave_application/leave_application_list.js b/erpnext/hr/doctype/leave_application/leave_application_list.js new file mode 100644 index 0000000000..e2a89013f7 --- /dev/null +++ b/erpnext/hr/doctype/leave_application/leave_application_list.js @@ -0,0 +1,4 @@ +frappe.listview_settings['Leave Application'] = { + add_fields: ["status", "leave_type", "employee", "employee_name", "total_leave_days", "from_date"], + filters:[["status","!=", "Rejected"], ["to_date", ">=", frappe.datetime.get_today()]] +}; diff --git a/erpnext/hr/doctype/salary_slip/salary_slip_list.html b/erpnext/hr/doctype/salary_slip/salary_slip_list.html new file mode 100644 index 0000000000..ef54450ef0 --- /dev/null +++ b/erpnext/hr/doctype/salary_slip/salary_slip_list.html @@ -0,0 +1,26 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + + + {%= doc.employee_name %} + +
+
+
+ + {%= doc.month %} + + + + {%= doc.fiscal_year %} + +
+
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip_list.js b/erpnext/hr/doctype/salary_slip/salary_slip_list.js new file mode 100644 index 0000000000..17f13d6bea --- /dev/null +++ b/erpnext/hr/doctype/salary_slip/salary_slip_list.js @@ -0,0 +1,3 @@ +frappe.listview_settings['Salary Slip'] = { + add_fields: ["employee", "employee_name", "fiscal_year", "month"], +}; diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.json b/erpnext/hr/doctype/salary_structure/salary_structure.json index c31696cab7..2ddd95be51 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.json +++ b/erpnext/hr/doctype/salary_structure/salary_structure.json @@ -227,7 +227,7 @@ ], "icon": "icon-file-text", "idx": 1, - "modified": "2014-05-27 03:49:17.438605", + "modified": "2014-08-05 06:56:27.038404", "modified_by": "Administrator", "module": "HR", "name": "Salary Structure", @@ -260,5 +260,6 @@ } ], "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "title_field": "employee_name" } \ No newline at end of file diff --git a/erpnext/hr/doctype/salary_structure/test_records.json b/erpnext/hr/doctype/salary_structure/test_records.json new file mode 100644 index 0000000000..28d37c2a32 --- /dev/null +++ b/erpnext/hr/doctype/salary_structure/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Salary Structure", + "name": "_Test Salary Structure 1" + } +] diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.py b/erpnext/hr/doctype/salary_structure/test_salary_structure.py new file mode 100644 index 0000000000..0a1db7ed16 --- /dev/null +++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.py @@ -0,0 +1,10 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_records = frappe.get_test_records('Salary Structure') + +class TestSalaryStructure(unittest.TestCase): + pass diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index 9b2c6d07eb..cdb494e7fd 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -7,11 +7,11 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.add_custom_button(__("Gantt Chart"), function() { frappe.route_options = {"project": doc.name} frappe.set_route("Gantt", "Task"); - }, "icon-tasks"); + }, "icon-tasks", true); cur_frm.add_custom_button(__("Tasks"), function() { frappe.route_options = {"project": doc.name} frappe.set_route("List", "Task"); - }, "icon-list"); + }, "icon-list", true); } } diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html new file mode 100644 index 0000000000..2ddef7a974 --- /dev/null +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html @@ -0,0 +1,35 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + + + {%= doc.customer_name %} + + + {% var style = { + "Scheduled": "default", + "Unscheduled": "default", + "Breakdown": "danger" + }[doc.maintenance_type] %} + + {%= doc.maintenance_type %} + + {% var style = doc.completion_status==="Partially Completed" ? "warning" : "success" %} + + {%= doc.completion_status %} + +
+
+ +
+ {% var completed = doc.completed, title = __("Completed") %} + {% include "templates/form_grid/includes/progress.html" %} +
+
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js new file mode 100644 index 0000000000..77f28d7ab3 --- /dev/null +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js @@ -0,0 +1,3 @@ +frappe.listview_settings['Maintenance Visit'] = { + add_fields: ["customer", "customer_name", "completion_status", "maintenance_type"], +}; diff --git a/erpnext/utilities/doctype/note/note_list.html b/erpnext/utilities/doctype/note/note_list.html new file mode 100644 index 0000000000..e106dd40f6 --- /dev/null +++ b/erpnext/utilities/doctype/note/note_list.html @@ -0,0 +1,16 @@ +
+
+
+ {%= list.get_avatar_and_id(doc) %} + + {% if(doc.public) { %} + + + + {% } %} + +
+
+
diff --git a/erpnext/utilities/doctype/note/note_list.js b/erpnext/utilities/doctype/note/note_list.js index b188941bc4..a713aca842 100644 --- a/erpnext/utilities/doctype/note/note_list.js +++ b/erpnext/utilities/doctype/note/note_list.js @@ -1,4 +1,5 @@ frappe.listview_settings['Note'] = { + add_fields: ["title", "public"], set_title_left: function() { frappe.set_route(); }