Merge pull request #14057 from ESS-LLP/enterprise_fix

Additional Salary Component - naming and date fix
This commit is contained in:
rohitwaghchaure 2018-05-15 22:26:45 +05:30 committed by GitHub
commit 29517c10af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 6 deletions

View File

@ -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",

View File

@ -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

View File

@ -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",

View File

@ -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