restructured erpnext and deleted unwanted

This commit is contained in:
nabinhait
2011-07-01 13:34:41 +05:30
parent c1c54c9400
commit ec097975d0
1280 changed files with 54494 additions and 88652 deletions

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Income Tax', 'parent': None, 'description': 'Income Tax', 'creation': '2010-04-02 10:33:23', 'is_active': 'Yes', 'modified': '2010-04-05 12:53:07', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Income Tax', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Professional Tax', 'parent': None, 'description': 'Professional Tax', 'creation': '2010-04-02 10:34:14', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:59', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Professional Tax', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Provident Fund', 'parent': None, 'description': 'Provident fund', 'creation': '2010-04-02 10:32:23', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:52', 'module': 'Payroll', 'doctype': 'Deduction Type', 'idx': None, 'parenttype': None, 'deduction_name': 'Provident Fund', 'trash_reason': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'ashwini@webnotestech.com', 'name': 'KRA Template-Appraisal', 'parent': None, 'to_doctype': 'Appraisal', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'module': 'Mapper', 'doctype': 'DocType Mapper', 'idx': None, 'parenttype': None, 'ref_doc_submitted': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_doctype': 'KRA Template', 'parentfield': None}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00901', 'parent': 'KRA Template-Appraisal', 'to_field': 'kra', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'kra', 'parentfield': 'field_mapper_details'}, {'map': 'Yes', 'modified_by': 'ashwini@webnotestech.com', 'name': 'FMD/00902', 'parent': 'KRA Template-Appraisal', 'to_field': 'per_weightage', 'creation': '2010-08-30 15:45:32', 'modified': '2010-09-01 14:25:40', 'doctype': 'Field Mapper Detail', 'match_id': 0, 'idx': 2, 'parenttype': 'DocType Mapper', 'checking_operator': None, 'check_reference_value': None, 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'from_field': 'per_weightage', 'parentfield': 'field_mapper_details'}, {'reference_key': '', 'modified_by': 'ashwini@webnotestech.com', 'name': 'TMD/0000090', 'parent': 'KRA Template-Appraisal', 'is_reference_table': None, 'to_field': 'appraisal_details', 'creation': '2010-08-30 15:45:32', 'reference_doctype_key': '', 'modified': '2010-09-01 14:25:40', 'doctype': 'Table Mapper Detail', 'match_id': 0, 'idx': 1, 'parenttype': 'DocType Mapper', 'from_table': 'KRA Sheet', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'to_table': 'Appraisal Detail', 'from_field': 'kra_sheet', 'validation_logic': 'name is not Null', 'parentfield': 'table_mapper_details'}]

View File

@@ -0,0 +1,388 @@
[
{
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'DocType Mapper',
'from_doctype': 'Salary Structure',
'idx': None,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'module': 'Mapper',
'name': 'Salary Structure-Salary Slip',
'owner': 'harshada@webnotestech.com',
'parent': None,
'parentfield': None,
'parenttype': None,
'ref_doc_submitted': None,
'to_doctype': 'Salary Slip'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'employee',
'idx': 1,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00598',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'employee'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'employee_name',
'idx': 2,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00599',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'employee_name'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'department',
'idx': 3,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00600',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'department'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'designation',
'idx': 4,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00601',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'designation'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'branch',
'idx': 5,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00602',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'branch'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'grade',
'idx': 6,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00603',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'grade'
},
{
'checking_operator': None,
'creation': '2011-02-10 15:57:32',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'total_earning',
'idx': 7,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00657',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'gross_pay'
},
{
'checking_operator': None,
'creation': '2011-02-10 15:57:32',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'total_deduction',
'idx': 8,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00656',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'total_deduction'
},
{
'checking_operator': None,
'creation': '2011-02-10 15:57:32',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'net_pay',
'idx': 9,
'map': 'Yes',
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00658',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'net_pay'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'e_type',
'idx': 10,
'map': 'Yes',
'match_id': 1,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00604',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'e_type'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'modified_value',
'idx': 11,
'map': 'Yes',
'match_id': 1,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00605',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'e_amount'
},
{
'checking_operator': None,
'creation': '2011-02-10 15:57:32',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'modified_value',
'idx': 12,
'map': 'Yes',
'match_id': 1,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00660',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'e_modified_amount'
},
{
'checking_operator': None,
'creation': '2011-02-11 12:50:51',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'depend_on_lwp',
'idx': 13,
'map': 'Yes',
'match_id': 1,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00661',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'e_depends_on_lwp'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'd_type',
'idx': 14,
'map': 'Yes',
'match_id': 2,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00606',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'd_type'
},
{
'checking_operator': None,
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'd_modified_amt',
'idx': 15,
'map': 'Yes',
'match_id': 2,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00607',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'd_amount'
},
{
'checking_operator': None,
'creation': '2011-02-10 15:57:32',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'd_modified_amt',
'idx': 16,
'map': 'Yes',
'match_id': 2,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00659',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'd_modified_amount'
},
{
'checking_operator': None,
'creation': '2011-02-11 12:50:51',
'docstatus': 0,
'doctype': 'Field Mapper Detail',
'from_field': 'depend_on_lwp',
'idx': 17,
'map': 'Yes',
'match_id': 2,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'FMD/00662',
'owner': 'Administrator',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper',
'to_field': 'd_depends_on_lwp'
},
{
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': None,
'from_table': 'Salary Structure',
'idx': 1,
'match_id': 0,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'TMD/0000063',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': None,
'to_table': 'Salary Slip',
'validation_logic': 'name is not null'
},
{
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': 'earning_details',
'from_table': 'Earning Detail',
'idx': 2,
'match_id': 1,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'TMD/0000064',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': 'earning_details',
'to_table': 'SS Earning Detail',
'validation_logic': 'name is not null'
},
{
'creation': '2010-12-14 10:23:25',
'docstatus': 0,
'doctype': 'Table Mapper Detail',
'from_field': 'deduction_details',
'from_table': 'Deduction Detail',
'idx': 3,
'match_id': 2,
'modified': '2011-02-12 18:31:40',
'modified_by': 'Administrator',
'name': 'TMD/0000065',
'owner': 'harshada@webnotestech.com',
'parent': 'Salary Structure-Salary Slip',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper',
'reference_doctype_key': None,
'reference_key': None,
'to_field': 'deduction_details',
'to_table': 'SS Deduction Detail',
'validation_logic': 'name is not null'
}
]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Basic', 'parent': None, 'description': 'Basic', 'creation': '2010-04-02 10:29:08', 'is_active': 'Yes', 'modified': '2010-04-05 12:52:35', 'earning_name': 'Basic', 'doctype': 'Earning Type', 'taxable': 'Yes', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'exemption_limit': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'House Rent Allowance', 'parent': None, 'description': 'House Rent Allowance', 'creation': '2010-04-02 10:29:29', 'is_active': 'Yes', 'modified': '2010-04-05 12:33:19', 'earning_name': 'House Rent Allowance', 'doctype': 'Earning Type', 'taxable': 'No', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'exemption_limit': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Calls', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:38', 'modified': '2010-08-23 18:26:38', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Calls', 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Food', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:30', 'modified': '2010-08-23 18:26:30', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Food', 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Medical', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:49', 'modified': '2010-08-23 18:26:49', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Medical', 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Others', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Others', 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'harshada@webnotestech.com', 'name': 'Travel', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Travel', 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'leave_type_name': 'Casual Leave', 'modified_by': 'Administrator', 'name': 'Casual Leave', 'parent': None, 'is_encash': 1, 'creation': '2010-04-02 10:52:32', 'is_active': 'Yes', 'modified': '2010-04-02 10:52:32', 'is_carry_forward': 1, 'doctype': 'Leave Type', 'max_days_allowed': '3', 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'leave_type_name': 'Compensatory Off', 'modified_by': 'Administrator', 'name': 'Compensatory Off', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:59:30', 'is_active': 'Yes', 'modified': '2010-04-02 10:59:30', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'leave_type_name': 'Leave Without Pay', 'modified_by': 'Administrator', 'name': 'Leave Without Pay', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:57:37', 'is_active': 'Yes', 'modified': '2010-04-02 10:57:37', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'leave_type_name': 'Privilege Leave', 'modified_by': 'Administrator', 'name': 'Privilege Leave', 'parent': None, 'is_encash': 1, 'creation': '2010-04-02 10:53:16', 'is_active': 'Yes', 'modified': '2010-04-02 10:53:16', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'leave_type_name': 'Sick Leave', 'modified_by': 'Administrator', 'name': 'Sick Leave', 'parent': None, 'is_encash': None, 'creation': '2010-04-02 10:54:12', 'is_active': 'Yes', 'modified': '2010-04-02 10:54:12', 'is_carry_forward': None, 'doctype': 'Leave Type', 'max_days_allowed': None, 'idx': None, 'parenttype': None, 'trash_reason': None, 'module': 'Payroll', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

603
hr/Module Def/HR/HR.txt Normal file
View File

@@ -0,0 +1,603 @@
[
{
'_last_update': None,
'creation': '2011-06-30 15:51:33',
'disabled': 'No',
'docstatus': 0,
'doctype': u'Module Def',
'doctype_list': None,
'file_list': None,
'idx': None,
'is_hidden': 'No',
'last_updated_date': None,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'module_desc': 'Human Resource Management - Employee Database, Salaries etc.',
'module_icon': 'HR.gif',
'module_label': 'HR',
'module_name': 'HR',
'module_page': None,
'module_seq': 9,
'name': 'HR',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'trash_reason': None,
'widget_code': None
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Your Employee Database',
'display_name': 'Employee',
'doc_name': 'Employee',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'employee_name\nemployment_type\nstatus\nbranch\ndesignation\ndepartment\ngrade\nreports_to',
'hide': None,
'icon': None,
'idx': 1,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01335',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Employees Daily Attendance Tracking Form',
'display_name': 'Attendance',
'doc_name': 'Attendance',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'employee\nemployee_name\nstatus\natt_date\nfiscal_year\ncompany',
'hide': None,
'icon': None,
'idx': 2,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01336',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Upload Attendance data',
'display_name': 'Attendance Control Panel',
'doc_name': 'Attendance Control Panel',
'doc_type': 'Single DocType',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 3,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01337',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Leave allocation for selected employees at a time',
'display_name': 'Leave Control Panel',
'doc_name': 'Leave Control Panel',
'doc_type': 'Single DocType',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 4,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01338',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Allocate leave for fiscal year',
'display_name': 'Leave Allocation',
'doc_name': 'Leave Allocation',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'employee\nleave_type\nfiscal_year\ntotal_leaves_allocated\nposting_date',
'hide': None,
'icon': None,
'idx': 5,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01339',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Apply Leave',
'display_name': 'Leave Application',
'doc_name': 'Leave Application',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'employee\nleave_type\nfiscal_year\nfrom_date\nto_date\ntotal_leave_days',
'hide': None,
'icon': None,
'idx': 6,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01340',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Submit Employees Expenses',
'display_name': 'Expense Voucher',
'doc_name': 'Expense Voucher',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\nemployee\nemployee_name\nposting_date\ntotal_claimed_amount\ntotal_sanctioned_amount\nexp_approver',
'hide': None,
'icon': None,
'idx': 7,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01341',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Assign Responsibilities to employee and evaluate',
'display_name': 'Appraisal',
'doc_name': 'Appraisal',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\nemployee\nemployee_name\nstart_date\nend_date\ntotal_score\nkra_approver',
'hide': None,
'icon': None,
'idx': 8,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01342',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Generate Salary Structure heads for an employee',
'display_name': 'Salary Structure',
'doc_name': 'Salary Structure',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'employee\nis_active\nfiscal_year\nfrom_date\nctc\ntotal_earning\ntotal_deduction\ntotal',
'hide': None,
'icon': None,
'idx': 9,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01343',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Generate Salary Slip for an employee',
'display_name': 'Salary Slip',
'doc_name': 'Salary Slip',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'month\nyear\nemployee\nemployee_name\npayment_days\narrear_amount\nencashment_amount\ngross_pay\ntotal_deduction\nnet_pay',
'hide': None,
'icon': None,
'idx': 10,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01344',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Generate Salary Slip for all employee at a time',
'display_name': 'Salary Slip Control Panel',
'doc_name': 'Salary Slip Control Panel',
'doc_type': 'Single DocType',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 11,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01345',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': 'Job Applications received for various positions',
'display_name': 'Job Application',
'doc_name': 'Job Application',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'applicant_name\nemail\nposition',
'hide': None,
'icon': None,
'idx': 12,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01346',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': None,
'display_name': 'Employee Information',
'doc_name': 'Employee',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 13,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01347',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': None,
'display_name': "Employee's Birthday",
'doc_name': 'Employee',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 14,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01348',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': None,
'display_name': 'New or left employees for a month',
'doc_name': 'Employee',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 15,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01349',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': None,
'display_name': 'Monthly Attendance Details',
'doc_name': 'Attendance',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 16,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01350',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:33',
'description': None,
'display_name': 'Leave Application Details',
'doc_name': 'Leave Application',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 17,
'modified': '2011-06-30 15:51:33',
'modified_by': 'Administrator',
'name': 'MDI01351',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Leave Allocation Details',
'doc_name': 'Leave Allocation',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 18,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01352',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Employee Leave Balance Report',
'doc_name': 'Employee',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 19,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01353',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Salary Structure Details',
'doc_name': 'Salary Structure',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 20,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01354',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Salary Register',
'doc_name': 'Salary Slip',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 21,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01355',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Salary Slips',
'doc_name': 'Salary Slip',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 22,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01356',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Pending Appraisals',
'doc_name': 'Appraisal',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 23,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01357',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Employee Appraisals',
'doc_name': 'Appraisal',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 24,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01358',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Pending Expense Vouchers',
'doc_name': 'Expense Voucher',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 25,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01359',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-06-30 15:51:34',
'description': None,
'display_name': 'Expense Vouchers',
'doc_name': 'Expense Voucher',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 26,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDI01360',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'creation': '2011-06-30 15:51:34',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 1,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDR00340',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'HR Manager'
},
{
'creation': '2011-06-30 15:51:34',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 2,
'modified': '2011-06-30 15:51:34',
'modified_by': 'Administrator',
'name': 'MDR00341',
'owner': 'Administrator',
'parent': 'HR',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'HR User'
}
]

View File

@@ -0,0 +1,17 @@
[
{
'creation': '2011-02-12 15:07:26',
'docstatus': 0,
'doctype': 'Role',
'idx': None,
'modified': '2011-02-14 14:05:55',
'modified_by': 'Administrator',
'module': 'Roles',
'name': 'Employee',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'role_name': 'Employee'
}
]

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'HR Manager', 'parent': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 10:19:09', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'HR Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'modified_by': 'Administrator', 'name': 'HR User', 'parent': None, 'creation': '2010-04-01 14:14:39', 'modified': '2010-04-01 10:18:55', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'HR User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]

0
hr/__init__.py Normal file
View File

0
hr/doctype/__init__.py Normal file
View File

View File

@@ -0,0 +1,137 @@
# DocType, Absent Days Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:51',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Absent Days Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Absent Days Detail',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Absent Days Detail
{
'doctype': 'DocType',
'name': 'Absent Days Detail'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'leave_type',
'fieldtype': 'Select',
'idx': 1,
'label': 'Leave Type',
'oldfieldname': 'leave_type',
'oldfieldtype': 'Select',
'options': 'link:Leave Type'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'no_of_leave_days',
'fieldtype': 'Data',
'idx': 2,
'label': 'No of leave days',
'oldfieldname': 'no_of_leave_days',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'from_date',
'fieldtype': 'Date',
'idx': 3,
'label': 'From Date',
'oldfieldname': 'from_date',
'oldfieldtype': 'Date'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'to_date',
'fieldtype': 'Date',
'idx': 4,
'label': 'To Date',
'oldfieldname': 'to_date',
'oldfieldtype': 'Date'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'previous_balance',
'fieldtype': 'Data',
'idx': 5,
'label': 'Previous Balance',
'oldfieldname': 'previous_balance',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'current_balance',
'fieldtype': 'Data',
'idx': 6,
'label': 'Current Balance',
'oldfieldname': 'current_balance',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'max_allowed',
'fieldtype': 'Data',
'idx': 7,
'label': 'Max. Allowed',
'oldfieldname': 'max_allowed',
'oldfieldtype': 'Data'
}
]

View File

View File

@@ -0,0 +1,145 @@
cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
if(doc.amended_from && doc.__islocal) cur_frm.cscript.refresh_appraisal_details(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(user == doc.kra_approver && doc.status == 'Submitted') unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
if(!doc.docstatus) unhide_field('Fetch Template');
else hide_field('Fetch Template');
}
cur_frm.cscript.refresh_appraisal_details = function(doc, cdt, cdn){
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
for(var i = 0; i<val.length; i++){
set_multiple('Appraisal Detail', val[i].name, {'target_achieved':'', 'score':'', 'scored_earned':''}, 'appraisal_details');
}
doc.total_score = '';
refresh_field('appraisal_details');
refresh_field('total_score');
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee){
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
if(r.message){
doc.employee_name = r.message['emp_nm'];
get_field(doc.doctype, 'kra_approver' , doc.name).options = r.message['app_lst'];
refresh_many(['kra_approver','employee_name']);
}
});
}
}
cur_frm.cscript['Calculate Total Score'] = function(doc,cdt,cdn){
//get_server_fields('calculate_total','','',doc,cdt,cdn,1);
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned)
}
doc.total_score = flt(total)
refresh_field('total_score')
}
/*cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
$c_obj(make_doclist(doc.doctype, doc.name),'declare_completed','', function(r,rt){
if(r.message){
refresh_field('Status');
cur_frm.cscript.refresh(doc,cdt,cdn);
}
});
}*/
cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
var declare_completed_dialog;
set_declare_completed_dialog = function() {
declare_completed_dialog = new Dialog(400, 200, 'Declare Completed');
declare_completed_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after declaring this Appraisal as completed. Are you sure, you want to declare it as completed ?</div>'],
['HTML', 'Response', '<div class = "comment" id="declare_completed_dialog_response"></div>'],
['HTML', 'Declare Completed', '<div></div>']
]);
var declare_completed_btn1 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
declare_completed_btn1.innerHTML = 'Yes';
declare_completed_btn1.onclick = function(){ declare_completed_dialog.add(); }
var declare_completed_btn2 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
declare_completed_btn2.innerHTML = 'No';
$y(declare_completed_btn2,{marginLeft:'4px'});
declare_completed_btn2.onclick = function(){ declare_completed_dialog.hide();}
declare_completed_dialog.onshow = function() {
$i('declare_completed_dialog_response').innerHTML = '';
}
declare_completed_dialog.refresh_dt = function(){
cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn);
msgprint("refersh done");
$c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){});
}
declare_completed_dialog.add = function() {
// sending...
$i('declare_completed_dialog_response').innerHTML = 'Processing...';
var m_arg = user+ '~~' + this.msg_nm_lst;
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'declare_completed','', function(r,rt){
if(r.message.status == 'Completed'){
$i('declare_completed_dialog_response').innerHTML = 'Done';
refresh_field('status');
declare_completed_dialog.refresh_dt();
hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
declare_completed_dialog.hide();
}
else if(r.message.status == 'Incomplete'){
$i('declare_completed_dialog_response').innerHTML = 'Incomplete Appraisal';
}
else if(r.message.status == 'No Score'){
$i('declare_completed_dialog_response').innerHTML = 'Calculate total score';
}
});
}
}
if(!declare_completed_dialog){
set_declare_completed_dialog();
}
declare_completed_dialog.doc = doc;
declare_completed_dialog.cdt = cdt;
declare_completed_dialog.cdn = cdn;
declare_completed_dialog.show();
}
cur_frm.cscript.score = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if (d.score){
total = flt(d.per_weightage*d.score)/100;
d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'appraisal_details');
}
else{
d.score_earned = '';
refresh_field('score_earned', d.name, 'appraisal_details');
}
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned);
}
doc.total_score = flt(total);
refresh_field('total_score');
}

View File

@@ -0,0 +1,147 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def get_employee_name(self):
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
emp_nm= emp_nm and emp_nm[0][0] or ''
self.doc.employee_name = emp_nm
return cstr(emp_nm)
def fetch_kra(self):
if not self.doc.kra_template:
msgprint("Please select KRA Template to be be fetched")
raise Exception
self.doc.clear_table(self.doclist,'appraisal_details')
get_obj('DocType Mapper', 'KRA Template-Appraisal').dt_map('KRA Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['KRA Template','Appraisal'],['KRA Sheet', 'Appraisal Detail']]")
def validate_dates(self):
if getdate(self.doc.start_date) > getdate(self.doc.end_date):
msgprint("End Date can not be less than Start Date")
raise Exception
def validate_existing_appraisal(self):
chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
if chk:
msgprint("You have already created Appraisal "+cstr(chk[0][0])+" in the current date range for employee "+cstr(self.doc.employee_name))
raise Exception
def validate_curr_appraisal(self):
for d in getlist(self.doclist, 'appraisal_details'):
if d.target_achieved or d.score:
if self.doc.status == 'Draft':
msgprint("Target achieved or Score can be added only for submitted Appraisal")
raise Exception
elif self.doc.status == 'Submitted' and session['user'] != self.doc.kra_approver:
msgprint("Target achieved or Score can be added only by Appraisal Approver")
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.start_date) < str(ysd) or str(self.doc.start_date) > str(yed) or str(self.doc.end_date) < str(ysd) or str(self.doc.end_date) > str(yed):
msgprint("Appraisal date range is not within the Fiscal Year selected")
raise Exception
def validate(self):
self.validate_dates()
self.validate_existing_appraisal()
self.validate_curr_appraisal()
self.validate_fiscal_year()
def set_approver(self):
ret={}
approver_lst =[]
emp_nm = self.get_employee_name()
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
if approver_lst1:
approver_lst=approver_lst1
else:
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
return ret
def calculate_total(self):
total = 0
for d in getlist(self.doclist, 'appraisal_details'):
if d.score:
total = total + flt(d.score_earned)
ret={'total_score':flt(total)}
return cstr(ret)
def declare_completed(self):
ret={}
for d in getlist(self.doclist, 'appraisal_details'):
if not d.target_achieved or not d.score or not d.score_earned:
msgprint("Please add 'Target Achieved' and 'Score' for all KPI")
ret = {'status':'Incomplete'}
return ret
if not self.doc.total_score:
msgprint("Please calculate total score using button 'Calculate Total Score'")
ret = {'status':'No Score'}
return ret
self.update_appraisal()
#set(self.doc, 'status', 'Completed')
ret = {'status':'Completed'}
return ret
def update_appraisal(self):
for d in getlist(self.doclist, 'appraisal_details'):
if not d.kra or not d.per_weightage:
msgprint("Please remove the extra blank row added")
raise Exception
d.save()
if self.doc.total_score:
set(self.doc,'total_score',self.doc.total_score)
def on_update(self):
set(self.doc, 'status', 'Draft')
def validate_total_weightage(self):
total_w = 0
for d in getlist(self.doclist, 'appraisal_details'):
total_w = flt(total_w) + flt(d.per_weightage)
if flt(total_w)>100 or flt(total_w)<100:
msgprint("Total of weightage assigned to KPI is "+cstr(total_w)+".It should be 100(%)")
raise Exception
def validate_appraisal_detail(self):
if not self.doc.kra_approver:
msgprint("Please mention the name of Approver")
raise Exception
if not getlist(self.doclist, 'appraisal_details'):
msgprint("Please add KRA Details")
raise Exception
self.validate_total_weightage()
def on_submit(self):
self.validate_appraisal_detail()
set(self.doc, 'status', 'Submitted')
def on_cancel(self):
set(self.doc, 'status', 'Cancelled')

View File

@@ -0,0 +1,415 @@
# DocType, Appraisal
[
# These values are common in all dictionaries
{
'creation': '2010-09-01 15:48:05',
'docstatus': 0,
'modified': '2011-06-27 14:39:10',
'modified_by': 'Administrator',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1308808105',
'autoname': 'APRSL.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'HR',
'name': '__common__',
'search_fields': 'status, employee, employee_name',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 160
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Appraisal
{
'doctype': 'DocType',
'name': 'Appraisal'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 1,
'role': 'System Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 0,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 6,
'permlevel': 0,
'role': 'HR User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 7,
'permlevel': 1,
'role': 'HR Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 8,
'permlevel': 1,
'role': 'HR User'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Employee Details',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'default': 'Draft',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 2,
'in_filter': 1,
'label': 'Status',
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nCompleted\nCancelled',
'permlevel': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'idx': 3,
'in_filter': 1,
'label': 'Employee',
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'idx': 4,
'in_filter': 1,
'label': 'Employee Name',
'oldfieldname': 'employee_name',
'oldfieldtype': 'Data',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 5,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Select',
'idx': 6,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'link:Company',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 7,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'start_date',
'fieldtype': 'Date',
'idx': 8,
'in_filter': 1,
'label': 'Start Date',
'oldfieldname': 'start_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'end_date',
'fieldtype': 'Date',
'idx': 9,
'in_filter': 1,
'label': 'End Date',
'oldfieldname': 'end_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'kra_approver',
'fieldtype': 'Select',
'idx': 10,
'in_filter': 0,
'label': 'Approver',
'oldfieldname': 'kra_approver',
'oldfieldtype': 'Select',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
'idx': 11,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'idx': 12,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '160px'
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 13,
'label': 'Declare Completed',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 14,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'Select template from which you want to fetch KRA',
'doctype': 'DocField',
'fieldname': 'kra_template',
'fieldtype': 'Link',
'idx': 15,
'label': 'KRA Template',
'oldfieldname': 'kra_template',
'oldfieldtype': 'Link',
'options': 'KRA Template',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 16,
'label': 'Fetch Template',
'oldfieldtype': 'Button',
'options': 'fetch_kra',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'hidden': 1,
'idx': 17,
'label': 'Update',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'appraisal_details',
'fieldtype': 'Table',
'idx': 18,
'label': 'Appraisal Details',
'oldfieldname': 'appraisal_details',
'oldfieldtype': 'Table',
'options': 'Appraisal Detail',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 19,
'label': 'Calculate Total Score',
'oldfieldtype': 'Button',
'options': 'calculate_total',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'total_score',
'fieldtype': 'Currency',
'idx': 20,
'label': 'Total Score',
'no_copy': 1,
'oldfieldname': 'total_score',
'oldfieldtype': 'Currency',
'permlevel': 1
}
]

View File

View File

@@ -0,0 +1,112 @@
# DocType, Appraisal Detail
[
# These values are common in all dictionaries
{
'creation': '2010-09-01 15:48:05',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'rahul@webnotestech.com',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': 'APRSLD.#####',
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 13
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Appraisal Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# DocType, Appraisal Detail
{
'doctype': 'DocType',
'name': 'Appraisal Detail'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Key Responsibility Area',
'doctype': 'DocField',
'fieldname': 'kra',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'KRA',
'oldfieldname': 'kra',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'per_weightage',
'fieldtype': 'Currency',
'idx': 2,
'label': 'Weightage (%)',
'oldfieldname': 'per_weightage',
'oldfieldtype': 'Currency',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldname': 'target_achieved',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Target Achieved',
'no_copy': 1,
'oldfieldname': 'target_achieved',
'oldfieldtype': 'Small Text',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'score',
'fieldtype': 'Select',
'idx': 4,
'label': 'Score (0-5)',
'no_copy': 1,
'oldfieldname': 'score',
'oldfieldtype': 'Select',
'options': '\n0\n1\n2\n3\n4\n5',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'score_earned',
'fieldtype': 'Currency',
'idx': 5,
'label': 'Score Earned',
'no_copy': 1,
'oldfieldname': 'score_earned',
'oldfieldtype': 'Currency',
'permlevel': 1
}
]

View File

View File

@@ -0,0 +1,14 @@
cur_frm.add_fetch('employee', 'company', 'company');
//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');
}
//Employee
//-----------------------------
cur_frm.fields_dict['employee'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabEmployee`.`name` FROM `tabEmployee` WHERE `tabEmployee`.status = "Active" AND `tabEmployee`.`docstatus`!= 2 AND `tabEmployee`.%(key)s LIKE "%s" ORDER BY `tabEmployee`.`name` ASC LIMIT 50';
}

View File

@@ -0,0 +1,130 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
#autoname function
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
#get employee name based on employee id selected
def get_emp_name(self):
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
#this is done because sometimes user entered wrong employee name while uploading employee attendance
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
return str(ret)
#validation for duplicate record
def validate_duplicate_record(self):
res = sql("select name from `tabAttendance` where employee = '%s' and att_date = '%s' and not name = '%s' and docstatus = 1"%(self.doc.employee,self.doc.att_date, self.doc.name))
if res:
msgprint("Employee's attendance already marked.")
raise Exception
#validation - leave_type is mandatory for status absent/ half day else not required to entered.
def validate_status(self):
if self.doc.status == 'Present' and self.doc.leave_type:
msgprint("You can not enter leave type for attendance status 'Present'")
raise Exception
elif (self.doc.status == 'Absent' or self.doc.status == 'Half Day') and not self.doc.leave_type:
msgprint("Please enter leave type for attendance status 'Absent'")
raise Exception
#check for already record present in leave transaction for same date
def check_leave_record(self):
if self.doc.status == 'Present':
chk = sql("select name from `tabLeave Transaction` where employee=%s and (from_date <= %s and to_date >= %s) and status = 'Submitted' and leave_transaction_type = 'Deduction' and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
if chk:
msgprint("Leave Application created for employee "+self.doc.employee+" whom you are trying to mark as 'Present' ")
raise Exception
#For absent/ half day record - check for leave balances of the employees
def validate_leave_type(self):
if not self.doc.status =='Present' and self.doc.leave_type not in ('Leave Without Pay','Compensatory Off'):
#check for leave allocated to employee from leave transaction
ret = sql("select name from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and leave_transaction_type = 'Allocation' and fiscal_year = '%s'"%(self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
#if leave allocation is present then calculate leave balance i.e. sum(allocation) - sum(deduction)
if ret:
q1 = 'SUM(CASE WHEN leave_transaction_type = "Allocation" THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = "Deduction" THEN total_leave ELSE 0 END)'
q2 = "select %s from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1"
res = sql(q2%(q1,self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
if res:
if self.doc.status == 'Absent' and flt(res[0][0]) < 1:
msgprint("%s balances are insufficient to cover a day absence, please select other leave type."%self.doc.leave_type)
raise Exception
if self.doc.status == 'Half Day' and flt(res[0][0]) < 0.5:
msgprint("%s balances are insufficient to cover a half day absence, please select other leave type."%self.doc.leave_type)
raise Exception
else:
msgprint("Leave Allocation for employee %s not done.\n You can allocate leaves from HR -> Leave Transaction OR HR -> Leave Control Panel."%self.doc.employee)
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"% self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.att_date) < str(ysd) or str(self.doc.att_date) > str(yed):
msgprint("'%s' Not Within The Fiscal Year selected"%(self.doc.att_date))
raise Exception
def validate_att_date(self):
import datetime
if getdate(self.doc.att_date)>getdate(datetime.datetime.now().date().strftime('%Y-%m-%d')):
msgprint("Attendance can not be marked for future dates")
raise Exception
# Validate employee
#-------------------
def validate_employee(self):
emp = sql("select name, status from `tabEmployee` where name = '%s'" % self.doc.employee)
if not emp:
msgprint("Employee: %s does not exists in the system" % self.doc.employee, raise_exception=1)
elif emp[0][1] != 'Active':
msgprint("Employee: %s is not Active" % self.doc.employee, raise_exception=1)
# validate...
def validate(self):
self.validate_fiscal_year()
self.validate_att_date()
#self.validate_leave_type()
self.validate_duplicate_record()
#self.validate_status()
self.check_leave_record()
def on_update(self):
#self.validate()
#this is done because sometimes user entered wrong employee name while uploading employee attendance
x=self.get_emp_name()
def on_submit(self):
#this is done because while uploading attendance chnage docstatus to 1 i.e. submit
set(self.doc,'docstatus',1)
pass

View File

@@ -0,0 +1,226 @@
# DocType, Attendance
[
# These values are common in all dictionaries
{
'creation': '2010-09-23 10:26:03',
'docstatus': 0,
'modified': '2011-06-27 14:39:08',
'modified_by': 'Administrator',
'owner': 'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1308808105',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'search_fields': 'employee, employee_name, att_date, status',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 74
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Attendance',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Attendance',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'submit': 1,
'write': 1
},
# DocType, Attendance
{
'doctype': 'DocType',
'name': 'Attendance'
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'HR Manager'
},
# DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Attendance Details',
'oldfieldtype': 'Section Break',
'options': 'Simple'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
'idx': 2,
'label': 'Naming Series',
'no_copy': 1,
'oldfieldname': 'naming_series',
'oldfieldtype': 'Select',
'options': 'ATT',
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'idx': 3,
'in_filter': 1,
'label': 'Employee',
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'idx': 4,
'label': 'Employee Name',
'oldfieldname': 'employee_name',
'oldfieldtype': 'Data'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 5,
'in_filter': 1,
'label': 'Status',
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nPresent\nAbsent\nHalf Day',
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'shifts',
'fieldtype': 'Select',
'idx': 6,
'label': 'Shifts',
'oldfieldname': 'shifts',
'oldfieldtype': 'Select',
'options': '\nDay\nNight',
'reqd': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'leave_type',
'fieldtype': 'Link',
'hidden': 1,
'idx': 7,
'label': 'Leave Type',
'oldfieldname': 'leave_type',
'oldfieldtype': 'Link',
'options': 'Leave Type',
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 8,
'oldfieldtype': 'Column Break',
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'att_date',
'fieldtype': 'Date',
'idx': 9,
'in_filter': 1,
'label': 'Attendance Date',
'oldfieldname': 'att_date',
'oldfieldtype': 'Date',
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 10,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Select',
'idx': 11,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'link:Company',
'reqd': 1
}
]

View File

@@ -0,0 +1,50 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
cur_frm.log_div = $a(cur_frm.fields_dict['Import Log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
hide_field('Import Log1')
doc.att_fr_date = get_today();
doc.file_list = '';
doc.overwrite = 0;
refresh_many(['att_fr_date','file_list','overwrite']);
}
//download attendance template - csv file
cur_frm.cscript['Get Template'] = function(doc,cdt,cdn){
if(doc.att_to_date && !doc.att_fr_date)
alert("Please enter 'Attendance To Date'");
else if(doc.att_to_date && doc.att_fr_date && doc.att_to_date < doc.att_fr_date)
alert("Attendance to date cannot be less than from date.");
else
$c_obj_csv(make_doclist(cdt,cdn),'get_att_list','');
}
//---------------------------------------------------------
cur_frm.cscript['Import'] = function(doc,cdt,cdn){
if(!doc.file_list){
alert("Please upload attendance data CSV file");
}
else{
var call_back = function(r,rt){
cur_frm.log_div.innerHTML = '';
if(r.message)
cur_frm.log_div.innerHTML = r.message;
cur_frm.cscript.refresh(doc,cdt,cdn);
}
$c_obj(make_doclist(cdt,cdn),'import_att_data','',call_back);
}
cur_frm.cscript.refresh(doc,cdt,cdn);
}
//====================================================
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(cur_frm.log_div.innerHTML == '')
hide_field('Import Log1');
else
unhide_field('Import Log1');
refresh_field('Import Log1');
}

View File

@@ -0,0 +1,105 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,d,dt):
self.doc, self.doclist = d,dt
#==========================================================================
def get_att_list(self):
lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
dt = self.date_diff_list() # get date list inbetween from date and to date
att_dt = self.get_att_data() # get default attendance data like fiscal yr, company, naming series
fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2")
for d in dt:
for r in res:
lst.append([r[0],r[1],d,'',fy,comp,sr])
return lst
#------------------------------------------------------------------------------
# get date list inbetween from date and to date
def date_diff_list(self):
import datetime
#get from date
att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
#get to date
att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
if att_to_date:
r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
else:
r = 1
dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)]
dt=([str(date) for date in dateList])
return dt
#------------------------------------------------------------------------------
def get_att_data(self):
fy = get_defaults()['fiscal_year'] #get default fiscal year
comp = get_defaults()['company'] #get default company
#get naming series of attendance
#sr = sql("select series_options from `tabNaming Series Options` where doc_type='Attendance'")
sr = sql("select options from `tabDocField` where parent = 'Attendance' and fieldname = 'naming_series'")
if not sr:
msgprint("Please create naming series for Attendance.\nGo to Setup--> Manage Series.")
raise Exception
else:
sr = sr and sr[0][0]
return {'fy':fy,'comp':comp,'sr':sr}
#=================================================================================
def import_att_data(self):
filename = self.doc.file_list.split(',')
if not filename:
msgprint("Please attach a .CSV File.")
raise Exception
if filename[0].find('.csv') < 0:
raise Exception
if not filename and filename[0] and file[1]:
msgprint("Please Attach File. ")
raise Exception
from webnotes.utils import file_manager
fn, content = file_manager.get_file(filename[1])
if not type(content) == str:
content = content.tostring()
import webnotes.model.import_docs
im = webnotes.model.import_docs.CSVImport()
out = im.import_csv(content,self.doc.import_date_format, cint(self.doc.overwrite))
return out

View File

@@ -0,0 +1,229 @@
# DocType, Attendance Control Panel
[
# These values are common in all dictionaries
{
'creation': '2010-10-19 11:19:24',
'docstatus': 0,
'modified': '2011-01-04 13:33:33',
'modified_by': 'rahul@webnotestech.com',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1294312182',
'allow_attach': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'max_attachments': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 122
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Attendance Control Panel',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Attendance Control Panel',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Attendance Control Panel
{
'doctype': 'DocType',
'name': 'Attendance Control Panel'
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'System Manager',
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0,
'role': 'HR User',
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'HR Manager',
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 1,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 5,
'permlevel': 1,
'role': 'HR Manager'
},
# DocField
{
'colour': 'White:FFF',
'description': "Get the template of the Attendance for which you want to import in CSV (Comma seperated values) format.\nFill data in the template. Save the template in CSV format.\nAll attendance dates inbetween 'Attendance From Date' and 'Attendance To Date' will come in the template with employees list.",
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Download Template',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'Selected Attendance date will comes in the attendance template.',
'doctype': 'DocField',
'fieldname': 'att_fr_date',
'fieldtype': 'Date',
'idx': 2,
'label': 'Attendance From Date',
'oldfieldname': 'attenadnce_date',
'oldfieldtype': 'Date',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 3,
'label': 'Get Template',
'oldfieldtype': 'Button',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 4,
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'All attendance dates inbetween selected Attendance From Date and Attendance To Date will come in the template with employees list.',
'doctype': 'DocField',
'fieldname': 'att_to_date',
'fieldtype': 'Date',
'idx': 5,
'label': 'Attendance To Date',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'To import attendance data, click on "Add" button, select the saved CSV file and click on "Upload".\nSelect the date format as attendance date format in CSV file.\nClick on "Import".',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 6,
'label': 'Upload Attendance Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'import_date_format',
'fieldtype': 'Select',
'idx': 7,
'label': 'Import Date Format ',
'options': 'yyyy-mm-dd\nmm/dd/yyyy\nmm/dd/yy\ndd-mm-yyyy\ndd/mm/yyyy',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'overwrite',
'fieldtype': 'Check',
'idx': 8,
'label': 'Overwrite',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 9,
'label': 'Import',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'file_list',
'fieldtype': 'Text',
'hidden': 1,
'idx': 10,
'label': 'File List',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 11,
'label': 'Import Log',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 12,
'label': 'Import Log1',
'permlevel': 0
}
]

View File

View File

View File

@@ -0,0 +1,104 @@
# DocType, Branch
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:53',
'docstatus': 0,
'modified': '2011-05-30 15:24:02',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:branch',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 11
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Branch',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Branch',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'submit': 0,
'write': 1
},
# DocType, Branch
{
'doctype': 'DocType',
'name': 'Branch'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'branch',
'fieldtype': 'Data',
'idx': 2,
'label': 'Branch',
'oldfieldname': 'branch',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

View File

@@ -0,0 +1,145 @@
# DocType, Chapter VI A Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:54',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 9
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Chapter VI A Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Chapter VI A Detail',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'role': 'System Manager'
},
# DocType, Chapter VI A Detail
{
'doctype': 'DocType',
'name': 'Chapter VI A Detail'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'particulars3',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Particulars',
'oldfieldname': 'particulars3',
'oldfieldtype': 'Small Text',
'permlevel': 1,
'reqd': 1,
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'under_section3',
'fieldtype': 'Data',
'idx': 2,
'label': 'Under Section',
'oldfieldname': 'under_section3',
'oldfieldtype': 'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'max_limit3',
'fieldtype': 'Currency',
'idx': 3,
'label': 'Max. Limit',
'oldfieldname': 'max_limit3',
'oldfieldtype': 'Currency',
'permlevel': 1,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'actual_amount3',
'fieldtype': 'Currency',
'idx': 4,
'label': 'Actual Amount',
'oldfieldname': 'actual_amount3',
'oldfieldtype': 'Currency',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'eligible_amount3',
'fieldtype': 'Currency',
'idx': 5,
'label': 'Eligible Amount',
'oldfieldname': 'eligible_amount3',
'oldfieldtype': 'Currency',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'modified_amount3',
'fieldtype': 'Currency',
'idx': 6,
'label': 'Modified Amount',
'oldfieldname': 'modified_amount3',
'oldfieldtype': 'Currency',
'permlevel': 0
}
]

View File

@@ -0,0 +1,144 @@
# DocType, Declaration Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:57',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'umair@iwebnotes.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Declaration Detail',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Declaration Detail',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'role': 'System Manager'
},
# DocType, Declaration Detail
{
'doctype': 'DocType',
'name': 'Declaration Detail'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'particulars1',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Particulars',
'oldfieldname': 'particulars1',
'oldfieldtype': 'Small Text',
'permlevel': 1,
'reqd': 1,
'width': '200px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'under_section1',
'fieldtype': 'Data',
'idx': 2,
'label': 'Under Section',
'oldfieldname': 'under_section1',
'oldfieldtype': 'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'max_limit1',
'fieldtype': 'Currency',
'idx': 3,
'label': 'Max. Limit',
'oldfieldname': 'max_limit1',
'oldfieldtype': 'Currency',
'permlevel': 1,
'reqd': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'actual_amount1',
'fieldtype': 'Currency',
'idx': 4,
'label': 'Actual Amount',
'oldfieldname': 'actual_amount1',
'oldfieldtype': 'Currency',
'permlevel': 0,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'eligible_amount1',
'fieldtype': 'Currency',
'idx': 5,
'label': 'Eligible Amount',
'oldfieldname': 'eligible_amount1',
'oldfieldtype': 'Currency',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'modified_amount1',
'fieldtype': 'Currency',
'idx': 6,
'label': 'Modified Amount',
'oldfieldname': 'modified_amount1',
'oldfieldtype': 'Currency',
'permlevel': 0
}
]

View File

View File

@@ -0,0 +1,77 @@
# DocType, Deduction Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:57',
'docstatus': 0,
'modified': '2010-11-02 20:44:58',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 14
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Deduction Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Deduction Detail
{
'doctype': 'DocType',
'name': 'Deduction Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'd_type',
'fieldtype': 'Link',
'idx': 1,
'label': 'Type',
'oldfieldname': 'd_type',
'oldfieldtype': 'Select',
'options': 'Deduction Type',
'reqd': 1,
'width': '200px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'd_modified_amt',
'fieldtype': 'Currency',
'idx': 3,
'label': 'Amount',
'oldfieldname': 'd_modified_amt',
'oldfieldtype': 'Currency'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'depend_on_lwp',
'fieldtype': 'Check',
'idx': 4,
'label': 'Depend on LWP',
'oldfieldname': 'depend_on_lwp',
'oldfieldtype': 'Check'
}
]

View File

View File

@@ -0,0 +1,115 @@
# DocType, Deduction Type
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:57',
'docstatus': 0,
'modified': '2010-10-12 17:19:47',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:deduction_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 10
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Deduction Type',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Deduction Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Deduction Type
{
'doctype': 'DocType',
'name': 'Deduction Type'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'deduction_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Name',
'oldfieldname': 'deduction_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'width': '300px'
}
]

View File

View File

View File

@@ -0,0 +1,102 @@
# DocType, Department
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:58',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:department_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Department',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Department',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Department
{
'doctype': 'DocType',
'name': 'Department'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'department_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Department',
'oldfieldname': 'department_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

View File

View File

View File

@@ -0,0 +1,102 @@
# DocType, Designation
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:58',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:designation_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Designation',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Designation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Designation
{
'doctype': 'DocType',
'name': 'Designation'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'designation_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Designation',
'oldfieldname': 'designation_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

View File

@@ -0,0 +1,116 @@
# DocType, Earn Deduction Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Earn Deduction Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Earn Deduction Detail',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'All',
'write': 1
},
# DocType, Earn Deduction Detail
{
'doctype': 'DocType',
'name': 'Earn Deduction Detail'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'earn_deduction_name',
'fieldtype': 'Data',
'idx': 1,
'label': 'Earn/Deduction Name',
'oldfieldname': 'earn_deduction_name',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'mode',
'fieldtype': 'Select',
'idx': 2,
'label': 'Mode',
'oldfieldname': 'mode',
'oldfieldtype': 'Select',
'options': '\n%\nRs'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'per',
'fieldtype': 'Data',
'idx': 3,
'label': 'Per.(%)',
'oldfieldname': 'per',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'amount',
'fieldtype': 'Data',
'idx': 4,
'label': 'Amount',
'oldfieldname': 'amount',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'type',
'fieldtype': 'Data',
'idx': 5,
'label': 'Type',
'oldfieldname': 'type',
'oldfieldtype': 'Data'
}
]

View File

View File

@@ -0,0 +1,80 @@
# DocType, Earning Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2011-02-09 13:02:55',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'hide_heading': 0,
'hide_toolbar': 0,
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 26
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Earning Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Earning Detail
{
'doctype': 'DocType',
'name': 'Earning Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'e_type',
'fieldtype': 'Link',
'idx': 1,
'label': 'Type',
'oldfieldname': 'e_type',
'oldfieldtype': 'Data',
'options': 'Earning Type',
'reqd': 1,
'width': '200px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'modified_value',
'fieldtype': 'Currency',
'idx': 2,
'label': 'Amount',
'oldfieldname': 'modified_value',
'oldfieldtype': 'Currency',
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'depend_on_lwp',
'fieldtype': 'Check',
'idx': 3,
'label': 'Depend on LWP',
'oldfieldname': 'depend_on_lwp',
'oldfieldtype': 'Check'
}
]

View File

View File

View File

@@ -0,0 +1,147 @@
# DocType, Earning Type
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2010-10-12 17:15:46',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:earning_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 13
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Earning Type',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Earning Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Earning Type
{
'doctype': 'DocType',
'name': 'Earning Type'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'earning_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Name',
'oldfieldname': 'earning_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'permlevel': 0,
'reqd': 0,
'width': '300px'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'taxable',
'fieldtype': 'Select',
'idx': 4,
'label': 'Taxable',
'oldfieldname': 'taxable',
'oldfieldtype': 'Select',
'options': '\nYes\nNo',
'permlevel': 0,
'reqd': 1,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'depends_on': "eval:doc.taxable=='No'",
'doctype': 'DocField',
'fieldname': 'exemption_limit',
'fieldtype': 'Currency',
'hidden': 1,
'idx': 5,
'label': 'Exemption Limit',
'oldfieldname': 'exemption_limit',
'oldfieldtype': 'Currency',
'permlevel': 0
}
]

View File

@@ -0,0 +1,117 @@
# DocType, Educational Qualifications
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 11
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Educational Qualifications',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Educational Qualifications
{
'doctype': 'DocType',
'name': 'Educational Qualifications'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'school_univ',
'fieldtype': 'Data',
'idx': 1,
'label': 'School/University',
'oldfieldname': 'school_univ',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'qualification',
'fieldtype': 'Data',
'idx': 2,
'label': 'Qualification (Degree/Diploma)',
'oldfieldname': 'qualification',
'oldfieldtype': 'Data',
'reqd': 0,
'search_index': 1,
'width': '170px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'level',
'fieldtype': 'Select',
'idx': 3,
'label': 'Level',
'oldfieldname': 'level',
'oldfieldtype': 'Select',
'options': '\nGraduate\nPost Graduate\nUnder Graduate',
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'year_of_passing',
'fieldtype': 'Int',
'idx': 4,
'label': 'Year of Passing',
'oldfieldname': 'year_of_passing',
'oldfieldtype': 'Int',
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'class_percent',
'fieldtype': 'Data',
'idx': 5,
'label': 'Class / Percentage',
'oldfieldname': 'class_percent',
'oldfieldtype': 'Data',
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'maj_opt_sub',
'fieldtype': 'Data',
'idx': 6,
'label': 'Major / Optional Subject',
'oldfieldname': 'maj_opt_sub',
'oldfieldtype': 'Data',
'reqd': 0,
'width': '170px'
}
]

View File

@@ -0,0 +1,109 @@
# DocType, Educational Qualifications Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:59',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Educational Qualifications Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Educational Qualifications Detail
{
'doctype': 'DocType',
'name': 'Educational Qualifications Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'school_univ',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'School/University',
'oldfieldname': 'school_univ',
'oldfieldtype': 'Small Text'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'qualification',
'fieldtype': 'Data',
'idx': 2,
'label': 'Qualification',
'oldfieldname': 'qualification',
'oldfieldtype': 'Data',
'width': '100px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'level',
'fieldtype': 'Select',
'idx': 3,
'label': 'Level',
'oldfieldname': 'level',
'oldfieldtype': 'Select',
'options': 'Graduate\nPost Graduate\nUnder Graduate'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'year_of_passing',
'fieldtype': 'Int',
'idx': 4,
'label': 'Year of Passing',
'oldfieldname': 'year_of_passing',
'oldfieldtype': 'Int'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'class_per',
'fieldtype': 'Data',
'idx': 5,
'label': 'Class / Percentage',
'oldfieldname': 'class_per',
'oldfieldtype': 'Data'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'maj_opt_subj',
'fieldtype': 'Text',
'idx': 6,
'label': 'Major/Optional Subjects',
'oldfieldname': 'maj_opt_subj',
'oldfieldtype': 'Text'
}
]

View File

View File

@@ -0,0 +1,51 @@
// get retirement date
//========================================================
cur_frm.cscript.date_of_birth = function(doc, dt, dn) {
get_server_fields('get_retirement_date','','',doc,dt,dn,1);
}
// salutation-gender
//========================================================
cur_frm.cscript.salutation = function(doc,dt,dn) {
if(doc.salutation){
if(doc.salutation=='Mr')
doc.gender='Male';
else if(doc.salutation=='Ms')
doc.gender='Female';
refresh_field('gender');
}
}
// On refresh
//========================================================
cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.__islocal!=1){
cur_frm.add_custom_button('Make Salary Structure', cur_frm.cscript['Make Salary Structure']);
}
}
//Make Salary Structure
//========================================================
cur_frm.cscript['Make Salary Structure']=function(){
$c_obj(make_doclist (doc.doctype,doc.name),'check_sal_structure',cur_frm.doc.name,function(r, rt) {
if(r.message)
alert("You have already created Active salary structure.\nIf you want to create new one, please ensure that no active salary structure exist.\nTo inactive salary structure select 'Is Active' as 'No'.");
else
cur_frm.cscript.make_salary_structure(cur_frm.doc);
});
}
// Load sal structure
//========================================================
cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
var st = LocalDB.create('Salary Structure');
st = locals['Salary Structure'][st];
st.employee = doc.name;
st.employee_name = doc.employee_name;
st.branch=doc.branch;
st.designation=doc.designation;
st.department=doc.department;
st.fiscal_year = doc.fiscal_year
st.grade=doc.grade;
loaddoc('Salary Structure', st.name);
}

View File

@@ -0,0 +1,118 @@
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
# Autoname
#========================================================================================================
def autoname(self):
ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
if not ret:
msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
raise Exception
else:
if ret[0][0]=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif ret[0][0]=='Employee Number':
self.doc.name = make_autoname(self.doc.employee_number)
# Get retirement date
#========================================================================================================
def get_retirement_date(self):
import datetime
ret = {}
if self.doc.date_of_birth:
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
return str(ret)
# check if salary structure exists
#========================================================================================================
def check_sal_structure(self, nm):
ret_sal_struct=sql("select name from `tabSalary Structure` where employee='%s' and is_active = 'Yes'"%nm)
return ret_sal_struct and ret_sal_struct[0][0] or ''
#========================================================================================================
def validate(self):
self.validate_date()
self.validate_email()
self.validate_name()
self.validate_status()
# Validate dates
#========================================================================================================
def validate_date(self):
import datetime
if self.doc.date_of_birth and self.doc.date_of_joining and getdate(self.doc.date_of_birth) >= getdate(self.doc.date_of_joining):
msgprint('Date of Joining must be greater than Date of Birth')
raise Exception
elif self.doc.scheduled_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.scheduled_confirmation_date) < getdate(self.doc.date_of_joining)):
msgprint('Scheduled Confirmation Date must be greater than Date of Joining')
raise Exception
elif self.doc.final_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.final_confirmation_date) < getdate(self.doc.date_of_joining)):
msgprint('Final Confirmation Date must be greater than Date of Joining')
raise Exception
elif self.doc.date_of_retirement and self.doc.date_of_joining and (getdate(self.doc.date_of_retirement) <= getdate(self.doc.date_of_joining)):
msgprint('Date Of Retirement must be greater than Date of Joining')
raise Exception
elif self.doc.relieving_date and self.doc.date_of_joining and (getdate(self.doc.relieving_date) <= getdate(self.doc.date_of_joining)):
msgprint('Relieving Date must be greater than Date of Joining')
raise Exception
elif self.doc.contract_end_date and self.doc.date_of_joining and (getdate(self.doc.contract_end_date)<=getdate(self.doc.date_of_joining)):
msgprint('Contract End Date must be greater than Date of Joining')
raise Exception
# Validate email id
#========================================================================================================
def validate_email(self):
if self.doc.company_email and not validate_email_add(self.doc.company_email):
msgprint("Please enter valid Company Email")
raise Exception
if self.doc.personal_email and not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
# Validate name
#========================================================================================================
def validate_name(self):
ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
if not ret:
msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
raise Exception
else:
if ret[0][0]=='Naming Series' and not self.doc.naming_series:
msgprint("Please select Naming Series.")
raise Exception
elif ret[0][0]=='Employee Number' and not self.doc.employee_number:
msgprint("Please enter Employee Number.")
raise Exception
# Validate status
#========================================================================================================
def validate_status(self):
if self.doc.status == 'Left' and not self.doc.relieving_date:
msgprint("Please enter relieving date.")
raise Exception

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1,44 @@
cur_frm.cscript.onload = function(doc, cdt, cdn){
$c('runserverobj', args={'method':'cal_tot_exp','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) { refresh_many(['year','months']); });
}
//===========================================================
cur_frm.cscript.employee = function(doc, cdt, cdn){
$c('runserverobj', args={'method':'get_doj','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) { refresh_many(['employee_name','date_of_joining']); });
}
//===========================================================
cur_frm.cscript.country1 = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state','arg':doc.country1, 'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
var doc = locals[mydoc.doctype][mydoc.name];
doc.state1 = '';
get_field(doc.doctype, 'state1' , doc.name).options = r.message;
refresh_field('state1');
}
}
);
}
//===========================================================
cur_frm.cscript.country2 = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state', 'arg':doc.country2,'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
var doc = locals[mydoc.doctype][mydoc.name];
doc.state2 = '';
get_field(doc.doctype, 'state2' , doc.name).options = r.message;
refresh_field('state2');
}
}
);
}

View File

@@ -0,0 +1,73 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
#init function
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
#=============================================================
def autoname(self):
self.doc.name = make_autoname('EMP-'+self.doc.employee)
#=============================================================
def validate(self):
if self.doc.personal_email:
if not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
ret = sql("select name from `tabEmployee Profile` where employee = '%s' and name !='%s'"%(self.doc.employee,self.doc.name))
if ret:
msgprint("Employee Profile is already created for Employee : '%s'"%self.doc.employee)
raise Exception
#=============================================================
def get_doj(self):
ret_doj = sql("select employee_name,date_of_joining from `tabEmployee` where name = '%s'"%self.doc.employee)
if ret_doj:
set(self.doc, 'employee_name', cstr(ret_doj[0][0]))
set(self.doc,'date_of_joining', ret_doj[0][1].strftime('%Y-%m-%d'))
#=============================================================
#calculate total experience in company - total year and month
def cal_tot_exp(self):
if not self.doc.date_of_joining:
self.get_doj()
import datetime
today = nowdate()
diff = (getdate(today) - getdate(self.doc.date_of_joining)).days
diff1 = cint(diff)/365
a = cint(diff)%365
diff2 = cint(a)/30
if(cint(diff1)<0):
set(self.doc,'year', 0)
else:
set(self.doc,'year', cint(diff1))
if(cint(diff1)<0):
set(self.doc,'months', 0)
else:
set(self.doc,'months', cint(diff2))
#=============================================================
def check_state(self,country):
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " %country)])

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,102 @@
# DocType, Employment Type
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:00',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:employee_type_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 16
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Employment Type',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Employment Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Employment Type
{
'doctype': 'DocType',
'name': 'Employment Type'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'employee_type_name',
'fieldtype': 'Data',
'idx': 1,
'label': 'Employment Type',
'oldfieldname': 'employee_type_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 2,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
}
]

View File

View File

View File

@@ -0,0 +1,101 @@
# DocType, Expense Type
[
# These values are common in all dictionaries
{
'creation': '2010-09-03 16:45:08',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': 'field:expense_type',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Expense Type',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Expense Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Expense Type
{
'doctype': 'DocType',
'name': 'Expense Type'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'System Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_type',
'fieldtype': 'Data',
'idx': 1,
'in_filter': 0,
'label': 'Expense Type',
'oldfieldname': 'expense_type',
'oldfieldtype': 'Data',
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 2,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'width': '300px'
}
]

View File

View File

@@ -0,0 +1,213 @@
cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.cscript.onload = function(doc,cdt,cdn){
//cur_frm.cscript.get_tips(doc, cdt, cdn);
if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
if (doc.__islocal) {
if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
for(var i = 0; i<val.length; i++){
val[i].sanctioned_amount ='';
}
//doc.total_claimed_amount = '';
doc.total_sanctioned_amount = '';
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
}
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('Calculate Total Amount');
else hide_field('Calculate Total Amount');
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['Update Voucher', 'Approve', 'Reject']);
else hide_field(['Update Voucher', 'Approve', 'Reject']);
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
else set_field_permlevel('remark', 1);
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee){
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
if(r.message){
doc.employee_name = r.message['emp_nm'];
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
refresh_many(['exp_approver','employee_name']);
}
});
}
}
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
if(doc.approval_status == 'Draft'){
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_claim =0;
for(var i = 0; i<val.length; i++){
total_claim = flt(total_claim)+flt(val[i].claim_amount);
}
doc.total_claimed_amount = flt(total_claim);
refresh_field('total_claimed_amount');
$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
if(r.message){
if(r.message['valid_approver'] == 'No'){
doc.exp_approver ='';
}
get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
refresh_field('exp_approver');
}
});
}
else if(doc.approval_status == 'Submitted'){
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_sanctioned = 0;
for(var i = 0; i<val.length; i++){
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
}
doc.total_sanctioned_amount = flt(total_sanctioned);
refresh_field('total_sanctioned_amount');
}
}
cur_frm.cscript['Calculate Total Amount'] = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript['Approve'] = function(doc,cdt,cdn){
if(user == doc.exp_approver){
var approve_voucher_dialog;
set_approve_voucher_dialog = function() {
approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
approve_voucher_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
['HTML', 'Approve Voucher', '<div></div>']
]);
var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
approve_voucher_btn1.innerHTML = 'Yes';
approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
approve_voucher_btn2.innerHTML = 'No';
$y(approve_voucher_btn2,{marginLeft:'4px'});
approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
approve_voucher_dialog.onshow = function() {
$i('approve_voucher_dialog_response').innerHTML = '';
}
approve_voucher_dialog.add = function() {
// sending...
$i('approve_voucher_dialog_response').innerHTML = 'Processing...';
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
if(r.message == 'Approved'){
$i('approve_voucher_dialog_response').innerHTML = 'Approved';
refresh_field('approval_status');
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
approve_voucher_dialog.hide();
}
else if(r.message == 'Incomplete'){
$i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
}
else if(r.message == 'No Amount'){
$i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
}
});
}
}
if(!approve_voucher_dialog){
set_approve_voucher_dialog();
}
approve_voucher_dialog.doc = doc;
approve_voucher_dialog.cdt = cdt;
approve_voucher_dialog.cdn = cdn;
approve_voucher_dialog.show();
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
}else{
msgprint("Expense Voucher can be approved by Approver only");
}
}
cur_frm.cscript['Reject'] = function(doc,cdt,cdn){
if(user == doc.exp_approver){
var reject_voucher_dialog;
set_reject_voucher_dialog = function() {
reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
reject_voucher_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
['HTML', 'Reject Voucher', '<div></div>']
]);
var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
reject_voucher_btn1.innerHTML = 'Yes';
reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
reject_voucher_btn2.innerHTML = 'No';
$y(reject_voucher_btn2,{marginLeft:'4px'});
reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
reject_voucher_dialog.onshow = function() {
$i('reject_voucher_dialog_response').innerHTML = '';
}
reject_voucher_dialog.add = function() {
// sending...
$i('reject_voucher_dialog_response').innerHTML = 'Processing...';
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
if(r.message == 'Rejected'){
$i('reject_voucher_dialog_response').innerHTML = 'Rejected';
refresh_field('approval_status');
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
reject_voucher_dialog.hide();
}
});
}
}
if(!reject_voucher_dialog){
set_reject_voucher_dialog();
}
reject_voucher_dialog.doc = doc;
reject_voucher_dialog.cdt = cdt;
reject_voucher_dialog.cdn = cdn;
reject_voucher_dialog.show();
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
}else{
msgprint("Expense Voucher can be rejected by Approver only");
}
}
//update follow up
//=================================================================================
cur_frm.cscript['Update Voucher'] = function(doc){
$c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
});
}

View File

@@ -0,0 +1,143 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def get_employee_name(self):
emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
emp_nm = emp_dtl and emp_dtl[0][0] or ''
self.doc.employee_name = emp_nm
self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
return cstr(emp_nm)
def get_approver_lst(self):
approver_lst =[]
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
if approver_lst1:
approver_lst=approver_lst1
else:
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
return approver_lst
def set_approver(self):
ret={}
approver_lst =[]
emp_nm = self.get_employee_name()
approver_lst = self.get_approver_lst()
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
return ret
def update_voucher(self):
sql("delete from `tabExpense Voucher Detail` where parent = '%s'"%self.doc.name)
for d in getlist(self.doclist, 'expense_voucher_details'):
if not d.expense_type or not d.claim_amount:
msgprint("Please remove the extra blank row added")
raise Exception
d.save(1)
if self.doc.total_sanctioned_amount:
set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
if self.doc.remark:
set(self.doc, 'remark', self.doc.remark)
def approve_voucher(self):
for d in getlist(self.doclist, 'expense_voucher_details'):
if not d.sanctioned_amount:
msgprint("Please add 'Sanctioned Amount' for all expenses")
return cstr('Incomplete')
if not self.doc.total_sanctioned_amount:
msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
return cstr('No Amount')
self.update_voucher()
set(self.doc, 'approval_status', 'Approved')
# on approval notification
get_obj('Notification Control').notify_contact('Expense Voucher Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
return cstr('Approved')
def reject_voucher(self):
if self.doc.remark:
set(self.doc, 'remark', self.doc.remark)
set(self.doc, 'approval_status', 'Rejected')
# on approval notification
get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
return cstr('Rejected')
def validate_curr_exp(self):
for d in getlist(self.doclist, 'expense_voucher_details'):
if flt(d.sanctioned_amount) > 0:
if self.doc.approval_status == 'Draft':
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Voucher")
raise Exception
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
msgprint("Sanctioned amount can be added only by expense voucher Approver")
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
msgprint("Posting Date is not within the Fiscal Year selected")
raise Exception
def validate(self):
self.validate_curr_exp()
self.validate_fiscal_year()
def on_update(self):
set(self.doc, 'approval_status', 'Draft')
def validate_exp_details(self):
if not getlist(self.doclist, 'expense_voucher_details'):
msgprint("Please add expense voucher details")
raise Exception
if not self.doc.total_claimed_amount:
msgprint("Please calculate Total Claimed Amount")
raise Exception
if not self.doc.exp_approver:
msgprint("Please select Expense Voucher approver")
raise Exception
def validate_approver(self):
app_lst = self.get_approver_lst()
if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
valid_app = 'No'
else:
valid_app = 'Yes'
ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
return ret
def on_submit(self):
self.validate_exp_details()
set(self.doc, 'approval_status', 'Submitted')
def on_cancel(self):
set(self.doc, 'approval_status', 'Cancelled')

View File

@@ -0,0 +1,439 @@
# DocType, Expense Voucher
[
# These values are common in all dictionaries
{
'creation': '2010-09-03 16:45:08',
'docstatus': 0,
'modified': '2011-06-27 14:39:09',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'_last_update': '1308808105',
'autoname': 'EXP.######',
'colour': 'White:FFF',
'doctype': 'DocType',
'module': 'HR',
'name': '__common__',
'search_fields': 'approval_status,employee,employee_name',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'subject': 'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
'tag_fields': 'approval_status',
'version': 134
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Expense Voucher',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1
},
# DocType, Expense Voucher
{
'doctype': 'DocType',
'name': 'Expense Voucher'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'match': 'owner',
'permlevel': 0,
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'permlevel': 0,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'permlevel': 0,
'role': 'HR User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'match': 'owner',
'permlevel': 0,
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'permlevel': 0,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'permlevel': 0,
'role': 'HR User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1,
'role': 'All'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Details',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'default': 'Draft',
'doctype': 'DocField',
'fieldname': 'approval_status',
'fieldtype': 'Select',
'idx': 2,
'in_filter': 1,
'label': 'Approval Status',
'no_copy': 1,
'oldfieldname': 'approval_status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
'permlevel': 1,
'search_index': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'idx': 3,
'in_filter': 1,
'label': 'From Employee',
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'idx': 4,
'in_filter': 1,
'label': 'Employee Name',
'oldfieldname': 'employee_name',
'oldfieldtype': 'Data',
'permlevel': 1,
'search_index': 1,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 5,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Select',
'idx': 6,
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'link:Company',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 7,
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
'idx': 8,
'in_filter': 1,
'label': 'Posting Date',
'oldfieldname': 'posting_date',
'oldfieldtype': 'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'exp_approver',
'fieldtype': 'Select',
'idx': 9,
'label': 'Approver',
'oldfieldname': 'exp_approver',
'oldfieldtype': 'Select',
'permlevel': 0,
'width': '160px'
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'remark',
'fieldtype': 'Small Text',
'idx': 10,
'label': 'Remark',
'no_copy': 1,
'oldfieldname': 'remark',
'oldfieldtype': 'Small Text',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'idx': 11,
'label': 'Amended From',
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '160px'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'idx': 12,
'label': 'Amendment Date',
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'width': '160px'
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
'hidden': 1,
'idx': 13,
'label': 'Approve',
'oldfieldtype': 'Button',
'permlevel': 0,
'print_hide': 1,
'trigger': 'Client'
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
'hidden': 1,
'idx': 14,
'label': 'Reject',
'oldfieldtype': 'Button',
'permlevel': 0,
'print_hide': 1,
'trigger': 'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 15,
'label': 'Expense Details',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 16,
'label': 'Calculate Total Amount',
'oldfieldtype': 'Button',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'trigger': 'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'total_claimed_amount',
'fieldtype': 'Currency',
'idx': 17,
'in_filter': 0,
'label': 'Total Claimed Amount',
'no_copy': 1,
'oldfieldname': 'total_claimed_amount',
'oldfieldtype': 'Currency',
'permlevel': 1,
'reqd': 0,
'width': '160px'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'total_sanctioned_amount',
'fieldtype': 'Currency',
'idx': 18,
'in_filter': 0,
'label': 'Total Sanctioned Amount',
'no_copy': 1,
'oldfieldname': 'total_sanctioned_amount',
'oldfieldtype': 'Currency',
'permlevel': 1,
'width': '160px'
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldtype': 'Button',
'hidden': 1,
'idx': 19,
'label': 'Update Voucher',
'oldfieldtype': 'Button',
'permlevel': 0,
'print_hide': 1,
'trigger': 'Client'
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldname': 'expense_voucher_details',
'fieldtype': 'Table',
'idx': 20,
'label': 'Expense Voucher Details',
'oldfieldname': 'expense_voucher_details',
'oldfieldtype': 'Table',
'options': 'Expense Voucher Detail',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'email_id',
'fieldtype': 'Data',
'hidden': 1,
'idx': 21,
'label': 'Employees Email Id',
'oldfieldname': 'email_id',
'oldfieldtype': 'Data',
'permlevel': 0,
'print_hide': 1
}
]

View File

@@ -0,0 +1,108 @@
# DocType, Expense Voucher Detail
[
# These values are common in all dictionaries
{
'creation': '2010-09-03 16:45:08',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'version': 5
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Expense Voucher Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Expense Voucher Detail
{
'doctype': 'DocType',
'name': 'Expense Voucher Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_date',
'fieldtype': 'Date',
'idx': 1,
'label': 'Expense Date',
'oldfieldname': 'expense_date',
'oldfieldtype': 'Date',
'reqd': 0,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'expense_type',
'fieldtype': 'Link',
'idx': 2,
'label': 'Expense Type',
'oldfieldname': 'expense_type',
'oldfieldtype': 'Link',
'options': 'Expense Type',
'reqd': 1,
'width': '150px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 3,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Small Text',
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'claim_amount',
'fieldtype': 'Currency',
'idx': 4,
'label': 'Claim Amount',
'oldfieldname': 'claim_amount',
'oldfieldtype': 'Currency',
'reqd': 1,
'trigger': 'Client',
'width': '150px'
},
# DocField
{
'allow_on_submit': 1,
'doctype': 'DocField',
'fieldname': 'sanctioned_amount',
'fieldtype': 'Currency',
'idx': 5,
'label': 'Sanctioned Amount',
'no_copy': 1,
'oldfieldname': 'sanctioned_amount',
'oldfieldtype': 'Currency',
'trigger': 'Client',
'width': '150px'
}
]

View File

@@ -0,0 +1,110 @@
# DocType, Experience In Company Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:01',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
'version': 6
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Experience In Company Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Experience In Company Detail
{
'doctype': 'DocType',
'name': 'Experience In Company Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'branch',
'fieldtype': 'Select',
'idx': 1,
'label': 'Branch',
'oldfieldname': 'branch',
'oldfieldtype': 'Select',
'options': 'link:Branch'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'department',
'fieldtype': 'Select',
'idx': 2,
'label': 'Department',
'oldfieldname': 'department',
'oldfieldtype': 'Select',
'options': 'link:Department'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'designation',
'fieldtype': 'Select',
'idx': 3,
'label': 'Designation',
'oldfieldname': 'designation',
'oldfieldtype': 'Select',
'options': 'link:Designation'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'grade',
'fieldtype': 'Select',
'idx': 4,
'label': 'Grade',
'oldfieldname': 'grade',
'oldfieldtype': 'Select',
'options': 'link:Grade'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'from_date',
'fieldtype': 'Date',
'idx': 5,
'label': 'From Date',
'oldfieldname': 'from_date',
'oldfieldtype': 'Date'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'to_date',
'fieldtype': 'Date',
'idx': 6,
'label': 'To Date',
'oldfieldname': 'to_date',
'oldfieldtype': 'Date'
}
]

View File

View File

103
hr/doctype/grade/grade.txt Normal file
View File

@@ -0,0 +1,103 @@
# DocType, Grade
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:03',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': 'field:grade_name',
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Grade',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Grade',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Grade
{
'doctype': 'DocType',
'name': 'Grade'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 1,
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'role': 'HR User',
'submit': 0
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 3,
'role': 'HR Manager'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'grade_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Grade',
'oldfieldname': 'grade_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
}
]

View File

View File

View File

@@ -0,0 +1,116 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
import datetime
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
# ---------
# autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.fiscal_year +"/"+ self.doc.holiday_list_name+"/.###")
# *************************************************** utilities ***********************************************
# ----------------
# validate values
# ----------------
def validate_values(self):
if not self.doc.fiscal_year:
msgprint("Please select Fiscal Year")
raise Exception
if not self.doc.weekly_off:
msgprint("Please select weekly off day")
raise Exception
# ------------------------------------
# get fiscal year start and end dates
# ------------------------------------
def get_fy_start_end_dates(self):
st_date = sql("select year_start_date from `tabFiscal Year` where name = '%s'" %(self.doc.fiscal_year))
st_date = st_date and st_date[0][0].strftime('%Y-%m-%d') or ''
ed_date = add_days(add_years(st_date,1), -1)
return st_date, ed_date
# -------------------------
# get weekly off date list
# -------------------------
def get_weekly_off_date_list(self, yr_start_date, yr_end_date):
days_dict, dt_list, lst_st = {'Monday':0,'Tuesday':1,'Wednesday':2,'Thursday':3,'Friday':4,'Saturday':5,'Sunday':6}, [], ''
w = cint(days_dict[self.doc.weekly_off]) # Weekly Off Day No.
st_dt_weekday = getdate(yr_start_date).weekday() # Year Start Date weekday()
if w == st_dt_weekday: # Get Start Date
lst_st = yr_start_date
dt_list.append(lst_st)
elif w > st_dt_weekday:
lst_st = add_days(yr_start_date,w - st_dt_weekday)
dt_list.append(lst_st)
else:
lst_st = add_days(yr_start_date,6 - st_dt_weekday + 1)
dt_list.append(lst_st)
while getdate(lst_st) < getdate(yr_end_date): # Get list of dates
lst_st = add_days(lst_st,7)
if getdate(lst_st) > getdate(yr_end_date):
break
dt_list.append(lst_st)
return dt_list
# ---------------------
# get weekly off dates
# ---------------------
def get_weekly_off_dates(self):
self.validate_values()
yr_start_date, yr_end_date = self.get_fy_start_end_dates()
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
for d in date_list:
ch = addchild(self.doc, 'holiday_list_details', 'Holiday List Detail', 1, self.doclist)
ch.description = self.doc.weekly_off
ch.holiday_date = d
# ------------
# clear table
# ------------
def clear_table(self):
self.doc.clear_table(self.doclist,'holiday_list_details')
# ***************************************** validate *************************************************
# ---------------------------
# check default holiday list
# ---------------------------
def update_default_holiday_list(self):
sql("update `tabHoliday List` set is_default = 0 where ifnull(is_default, 0) = 1 and fiscal_year = '%s'" % (self.doc.fiscal_year))
# ---------
# validate
# ---------
def validate(self):
self.update_default_holiday_list()

View File

@@ -0,0 +1,167 @@
# DocType, Holiday List
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:03',
'docstatus': 0,
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 17
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType'
},
# These values are common for all DocPerm
{
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Holiday List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'read': 1,
'role': 'HR Manager'
},
# DocType, Holiday List
{
'doctype': 'DocType',
'name': 'Holiday List'
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'holiday_list_name',
'fieldtype': 'Data',
'idx': 2,
'label': 'Holiday List Name',
'oldfieldname': 'holiday_list_name',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'is_default',
'fieldtype': 'Check',
'idx': 3,
'label': 'Default',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 4,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Link',
'options': 'link:Fiscal Year',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'weekly_off',
'fieldtype': 'Select',
'idx': 5,
'label': 'Weekly Off',
'no_copy': 1,
'options': '\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 6,
'label': 'Get Weekly Off Dates',
'options': 'get_weekly_off_dates',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'holiday_list_details',
'fieldtype': 'Table',
'idx': 7,
'label': 'Holiday List Details',
'oldfieldname': 'holiday_list_details',
'oldfieldtype': 'Table',
'options': 'Holiday List Detail',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 8,
'label': 'Clear Table',
'options': 'clear_table',
'permlevel': 0
}
]

View File

@@ -0,0 +1,65 @@
# DocType, Holiday List Detail
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:09:03',
'docstatus': 0,
'modified': '2011-02-11 14:23:09',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': 'HR',
'name': '__common__',
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 4
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Holiday List Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# DocType, Holiday List Detail
{
'doctype': 'DocType',
'name': 'Holiday List Detail'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'idx': 1,
'label': 'Description',
'oldfieldname': 'holiday_name',
'oldfieldtype': 'Data',
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'holiday_date',
'fieldtype': 'Date',
'idx': 2,
'label': 'Date',
'oldfieldname': 'holiday_date',
'oldfieldtype': 'Date',
'width': '100px'
}
]

Some files were not shown because too many files have changed in this diff Show More