From fced017aad69f3c4a62d7e5a5660d5d2fd9c8e94 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 12 Nov 2012 12:07:28 +0530 Subject: [PATCH] renamed employee leave balance report --- .../__init__.py | 1 - .../employeewise_balance_leave_report.js | 40 ----------- .../employeewise_balance_leave_report.py | 72 ------------------- .../employeewise_balance_leave_report.sql | 26 ------- .../employeewise_balance_leave_report.txt | 34 --------- .../employeewise_balance_leave_report.py | 2 + patches/patch_list.py | 4 ++ 7 files changed, 6 insertions(+), 173 deletions(-) delete mode 100644 hr/search_criteria/employeewise_balance_leave_report/__init__.py delete mode 100644 hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js delete mode 100644 hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py delete mode 100644 hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.sql delete mode 100644 hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt diff --git a/hr/search_criteria/employeewise_balance_leave_report/__init__.py b/hr/search_criteria/employeewise_balance_leave_report/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/hr/search_criteria/employeewise_balance_leave_report/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js b/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js deleted file mode 100644 index 88d1cb4e3f..0000000000 --- a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.js +++ /dev/null @@ -1,40 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -this.mytabs.items['Select Columns'].hide(); - -this.mytabs.tabs['More Filters'].hide(); - -report.customize_filters = function() { - this.add_filter({ - fieldname:'fiscal_year', - label:'Fiscal Year', - fieldtype:'Link', - ignore : 1, - options: 'Fiscal Year', - parent:'Leave Allocation', - in_first_page:1 - }); - this.add_filter({ - fieldname:'employee_name', - label:'Employee Name', - fieldtype:'Data', - ignore : 1, - options: '', - parent:'Leave Allocation', - in_first_page:1 - }); -} \ No newline at end of file diff --git a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py b/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py deleted file mode 100644 index cb822100d1..0000000000 --- a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.py +++ /dev/null @@ -1,72 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import unicode_literals -leave_types = sql(""" - SELECT name FROM `tabLeave Type` - WHERE - docstatus!=2 AND - name NOT IN ('Compensatory Off', 'Leave Without Pay')""") -col=[] -col.append(['Employee ID', 'Data', '150px', '']) -col.append(['Employee Name', 'Data', '150px', '']) -col.append(['Fiscal Year', 'Data', '150px', '']) - -for e in leave_types: - l = (len(e[0])*9) - if l < 150 : col_width = '150px' - else: col_width = '%spx'%(l) - col.append([e[0],'Currency',col_width,'']) - -col.append(['Total Balance','Currency','150px','']) - -for c in col: - colnames.append(c[0]) - coltypes.append(c[1]) - colwidths.append(c[2]) - coloptions.append(c[3]) - col_idx[c[0]] = len(colnames) - -data = res -res = [] - -try: - for d in data: - exists = 0 - ind = None - - # Check if the employee record exists in list 'res' - for r in res: - if r[0] == d[0] and r[1] == d[1]: - exists = 1 - ind = res.index(r) - break - if d[3] in colnames: - # If exists, then append the leave type data - if exists: - res[ind][colnames.index(d[3])] = d[4] - d[5] - res[ind][len(colnames)-1] = sum(res[ind][3:-1]) - # Else create a new row in res - else: - new_row = [0.0 for c in colnames] - new_row[0] = d[0] - new_row[1] = d[1] - new_row[2] = d[2] - new_row[colnames.index(d[3])] = d[4] - d[5] - new_row[len(colnames)-1] = sum(new_row[3:-1]) - res.append(new_row) -except Exception, e: - msgprint(e) \ No newline at end of file diff --git a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.sql b/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.sql deleted file mode 100644 index 50811c0aa2..0000000000 --- a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.sql +++ /dev/null @@ -1,26 +0,0 @@ -SELECT - leave_alloc.employee AS 'employee', - leave_alloc.employee_name AS 'employee_name', - leave_alloc.fiscal_year AS 'fiscal_year', - leave_alloc.leave_type AS 'leave_type', - leave_alloc.total_leaves_allocated AS 'total_leaves_allocated', - SUM(leave_app.total_leave_days) AS 'total_leaves_applied' -FROM - `tabLeave Allocation` AS leave_alloc, - `tabLeave Application` AS leave_app -WHERE - leave_alloc.employee=leave_app.employee AND - leave_alloc.leave_type=leave_app.leave_type AND - leave_alloc.fiscal_year=leave_app.fiscal_year AND - leave_alloc.docstatus=1 AND - leave_app.docstatus=1 AND - leave_alloc.fiscal_year LIKE '%(fiscal_year)s%%' AND - leave_alloc.employee_name LIKE '%(employee_name)s%%' -GROUP BY - employee, - fiscal_year, - leave_type -ORDER BY - employee, - fiscal_year, - leave_type \ No newline at end of file diff --git a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt b/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt deleted file mode 100644 index 7a7f04988e..0000000000 --- a/hr/search_criteria/employeewise_balance_leave_report/employeewise_balance_leave_report.txt +++ /dev/null @@ -1,34 +0,0 @@ -# Search Criteria, employeewise_balance_leave_report -[ - - # These values are common in all dictionaries - { - 'creation': '2010-12-14 10:33:09', - 'docstatus': 0, - 'modified': '2011-10-31 15:42:36', - 'modified_by': 'Administrator', - 'owner': 'harshada@webnotestech.com' - }, - - # These values are common for all Search Criteria - { - 'columns': 'Employee\x01ID', - 'criteria_name': 'Employee Leave Balance Report', - 'description': 'Employeewise Balance Leave Report', - 'doc_type': 'Employee', - 'doctype': 'Search Criteria', - 'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':'Active'}", - 'module': 'HR', - 'name': '__common__', - 'page_len': 100, - 'sort_by': '`tabEmployee`.`name`', - 'sort_order': 'ASC', - 'standard': 'Yes' - }, - - # Search Criteria, employeewise_balance_leave_report - { - 'doctype': 'Search Criteria', - 'name': 'employeewise_balance_leave_report' - } -] \ No newline at end of file diff --git a/patches/before_jan_2012/employeewise_balance_leave_report.py b/patches/before_jan_2012/employeewise_balance_leave_report.py index 315b7844c8..45b00ae7bf 100644 --- a/patches/before_jan_2012/employeewise_balance_leave_report.py +++ b/patches/before_jan_2012/employeewise_balance_leave_report.py @@ -20,6 +20,8 @@ from __future__ import unicode_literals of search criteria "employeewise_balance_leave_report" from "Employeewise Balance Leave Report" to "Employee Leave Balance Report" + + This patch never worked!!! """ def execute(): from webnotes.model.doc import Document diff --git a/patches/patch_list.py b/patches/patch_list.py index de1fd94f84..1a9ebb1134 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -655,4 +655,8 @@ patch_list = [ 'patch_module': 'patches.november_2012', 'patch_file': 'delete_item_sales_register1', }, + { + 'patch_module': 'patches.november_2012', + 'patch_file': 'rename_employee_leave_balance_report', + }, ]