From a46ce11af9482c3966884a22d76264b6538fe1ad Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Tue, 15 May 2018 19:20:51 +0530 Subject: [PATCH 1/3] Additional Salary Component - naming and date fix --- .../additional_salary_component.json | 36 +++++++++++++++++-- .../additional_salary_component.py | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json b/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json index 47b090469e..e60e5edec8 100644 --- a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json +++ b/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, - "autoname": "field:salary_component", + "autoname": "naming_series:", "beta": 0, "creation": "2018-05-10 12:04:08.396461", "custom": 0, @@ -13,6 +13,38 @@ "editable_grid": 1, "engine": "InnoDB", "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "ASC-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -306,7 +338,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-05-10 12:54:06.155708", + "modified": "2018-05-15 19:15:29.612105", "modified_by": "Administrator", "module": "HR", "name": "Additional Salary Component", diff --git a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py b/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py index 216dea0403..7a07ae0e95 100644 --- a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py +++ b/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py @@ -32,7 +32,7 @@ class AdditionalSalaryComponent(Document): if getdate(sal_start_date) <= getdate(self.from_date): start_date = getdate(self.from_date) if getdate(sal_end_date) > getdate(self.to_date): - end_date = getdate(self.end_date) + end_date = getdate(self.to_date) no_of_days = date_diff(getdate(end_date), getdate(start_date)) return amount_per_day * no_of_days From ebb68afecbfbc91467ebb42f107286e1087aba38 Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Tue, 15 May 2018 19:41:25 +0530 Subject: [PATCH 2/3] Leave Allocation - remove link to compensatory leave request --- .../leave_allocation/leave_allocation.json | 50 ++++++------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.json b/erpnext/hr/doctype/leave_allocation/leave_allocation.json index c1758aa3dd..5563871758 100644 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.json +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.json @@ -42,6 +42,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 1, + "translatable": 0, "unique": 0 }, { @@ -74,6 +75,7 @@ "reqd": 1, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -103,6 +105,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -131,6 +134,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -163,6 +167,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "300px" }, @@ -193,6 +198,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -225,6 +231,7 @@ "reqd": 1, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -255,6 +262,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -285,6 +293,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -314,6 +323,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -343,6 +353,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -373,6 +384,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -403,6 +415,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -435,38 +448,6 @@ "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "compensatory_request", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Compensatory Leave Request", - "length": 0, - "no_copy": 0, - "options": "Compensatory Leave Request", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -529,6 +510,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -543,7 +525,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-19 19:34:59.248428", + "modified": "2018-05-15 19:34:26.808105", "modified_by": "Administrator", "module": "HR", "name": "Leave Allocation", @@ -551,7 +533,6 @@ "permissions": [ { "amend": 1, - "apply_user_permissions": 0, "cancel": 1, "create": 1, "delete": 1, @@ -571,7 +552,6 @@ }, { "amend": 1, - "apply_user_permissions": 0, "cancel": 1, "create": 1, "delete": 1, From 3beeb7255f3688ccbe1591b41488e3830550ade1 Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Tue, 15 May 2018 19:42:27 +0530 Subject: [PATCH 3/3] Compensatory Leave Request - add link to leave allocation --- .../compensatory_leave_request.json | 34 ++++++++++++++++++- .../compensatory_leave_request.py | 5 +-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.json b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.json index f8b91a6bc1..f7af577213 100644 --- a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.json +++ b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.json @@ -232,6 +232,38 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "leave_allocation", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Leave Allocation", + "length": 0, + "no_copy": 0, + "options": "Leave Allocation", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -274,7 +306,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-14 15:36:39.668733", + "modified": "2018-05-15 19:37:13.742710", "modified_by": "Administrator", "module": "HR", "name": "Compensatory Leave Request", diff --git a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py index b4e71ce96a..6a67d47fd4 100644 --- a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py +++ b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py @@ -28,7 +28,8 @@ class CompensatoryLeaveRequest(Document): leave_allocation.new_leaves_allocated += date_difference leave_allocation.submit() else: - self.create_leave_allocation(leave_period, date_difference) + leave_allocation = self.create_leave_allocation(leave_period, date_difference) + self.db_set("leave_allocation", leave_allocation.name) else: frappe.throw(_("There is no leave period in between {0} and {1}").format(self.work_from_date, self.work_end_date)) @@ -63,9 +64,9 @@ class CompensatoryLeaveRequest(Document): allocation.to_date = leave_period[0].to_date allocation.new_leaves_allocated = date_difference allocation.total_leaves_allocated = date_difference - allocation.compensatory_request = self.name allocation.description = self.reason if is_carry_forward == 1: allocation.carry_forward = True allocation.save(ignore_permissions = True) allocation.submit() + return allocation