fix: multiple changes
This commit is contained in:
parent
bafc89f439
commit
3662ed50d2
@ -430,7 +430,7 @@
|
|||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Expire Carry Forwarded Leaves After Days",
|
"label": "Expire Carry Forwarded Leaves (Days)",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -728,7 +728,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2019-08-01 15:38:39.334283",
|
"modified": "2019-08-02 15:38:39.334283",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Type",
|
"name": "Leave Type",
|
||||||
|
|||||||
@ -14,4 +14,4 @@ class LeaveType(Document):
|
|||||||
if self.is_lwp:
|
if self.is_lwp:
|
||||||
leave_allocation = frappe.db.sql_list("""select name from `tabLeave Allocation` where leave_type=%s""", (self.name))
|
leave_allocation = frappe.db.sql_list("""select name from `tabLeave Allocation` where leave_type=%s""", (self.name))
|
||||||
if leave_allocation:
|
if leave_allocation:
|
||||||
frappe.throw(_("""Leave application is linked with leave allocations {0}. Leave application cannot be set as leave without pay""").format(", ".join(leave_allocation))) #nosec
|
frappe.throw(_('Leave application is linked with leave allocations {0}. Leave application cannot be set as leave without pay').format(", ".join(leave_allocation))) #nosec
|
||||||
@ -66,7 +66,7 @@ def get_data(filters, leave_types):
|
|||||||
filters.from_date, filters.to_date) * -1
|
filters.from_date, filters.to_date) * -1
|
||||||
|
|
||||||
# opening balance
|
# opening balance
|
||||||
opening = get_leave_balance_on(employee.name, leave_type, filters.from_date)
|
opening = get_total_allocated_leaves(employee.name, leave_type, filters.from_date, filters.to_date)
|
||||||
|
|
||||||
# closing balance
|
# closing balance
|
||||||
closing = flt(opening) - flt(leaves_taken)
|
closing = flt(opening) - flt(leaves_taken)
|
||||||
|
|||||||
@ -266,8 +266,10 @@ def get_leave_period(from_date, to_date, company):
|
|||||||
def generate_leave_encashment():
|
def generate_leave_encashment():
|
||||||
''' Generates a draft leave encashment on allocation expiry '''
|
''' Generates a draft leave encashment on allocation expiry '''
|
||||||
from erpnext.hr.doctype.leave_encashment.leave_encashment import create_leave_encashment
|
from erpnext.hr.doctype.leave_encashment.leave_encashment import create_leave_encashment
|
||||||
|
|
||||||
if frappe.db.get_single_value('HR Settings', 'auto_leave_encashment'):
|
if frappe.db.get_single_value('HR Settings', 'auto_leave_encashment'):
|
||||||
leave_type = frappe.db.sql_list("SELECT name FROM `tabLeave Type` WHERE `allow_encashment`=1")
|
leave_type = frappe.get_all('Leave Type', filters={'allow_encashment': 1}, fields=['name'])
|
||||||
|
leave_type=[l['name'] for l in leave_type]
|
||||||
|
|
||||||
leave_allocation = frappe.get_all("Leave Allocation", filters={
|
leave_allocation = frappe.get_all("Leave Allocation", filters={
|
||||||
'to_date': add_days(today(), -1),
|
'to_date': add_days(today(), -1),
|
||||||
@ -285,9 +287,8 @@ def allocate_earned_leaves():
|
|||||||
divide_by_frequency = {"Yearly": 1, "Half-Yearly": 6, "Quarterly": 4, "Monthly": 12}
|
divide_by_frequency = {"Yearly": 1, "Half-Yearly": 6, "Quarterly": 4, "Monthly": 12}
|
||||||
|
|
||||||
for e_leave_type in e_leave_types:
|
for e_leave_type in e_leave_types:
|
||||||
leave_allocations = frappe.db.sql("""select name, employee, from_date, to_date from `tabLeave Allocation` where '{0}'
|
leave_allocations = frappe.db.sql("""select name, employee, from_date, to_date from `tabLeave Allocation` where %s
|
||||||
between from_date and to_date and docstatus=1 and leave_type='{1}'"""
|
between from_date and to_date and docstatus=1 and leave_type=%s""", (today, e_leave_type.name), as_dict=1)
|
||||||
.format(today, e_leave_type.name), as_dict=1)
|
|
||||||
for allocation in leave_allocations:
|
for allocation in leave_allocations:
|
||||||
leave_policy = get_employee_leave_policy(allocation.employee)
|
leave_policy = get_employee_leave_policy(allocation.employee)
|
||||||
if not leave_policy:
|
if not leave_policy:
|
||||||
@ -295,8 +296,10 @@ def allocate_earned_leaves():
|
|||||||
if not e_leave_type.earned_leave_frequency == "Monthly":
|
if not e_leave_type.earned_leave_frequency == "Monthly":
|
||||||
if not check_frequency_hit(allocation.from_date, today, e_leave_type.earned_leave_frequency):
|
if not check_frequency_hit(allocation.from_date, today, e_leave_type.earned_leave_frequency):
|
||||||
continue
|
continue
|
||||||
annual_allocation = frappe.db.sql("""select annual_allocation from `tabLeave Policy Detail`
|
annual_allocation = frappe.get_all("Leave Policy Detail", filters={
|
||||||
where parent=%s and leave_type=%s""", (leave_policy.name, e_leave_type.name))
|
'parent': leave_policy.name,
|
||||||
|
'leave_type': e_leave_type.name
|
||||||
|
}, fields=['annual_allocation'])
|
||||||
if annual_allocation and annual_allocation[0]:
|
if annual_allocation and annual_allocation[0]:
|
||||||
earned_leaves = flt(annual_allocation[0][0]) / divide_by_frequency[e_leave_type.earned_leave_frequency]
|
earned_leaves = flt(annual_allocation[0][0]) / divide_by_frequency[e_leave_type.earned_leave_frequency]
|
||||||
if e_leave_type.rounding == "0.5":
|
if e_leave_type.rounding == "0.5":
|
||||||
|
|||||||
@ -603,7 +603,6 @@ erpnext.patches.v11_1.set_salary_details_submittable
|
|||||||
erpnext.patches.v11_1.rename_depends_on_lwp
|
erpnext.patches.v11_1.rename_depends_on_lwp
|
||||||
execute:frappe.delete_doc("Report", "Inactive Items")
|
execute:frappe.delete_doc("Report", "Inactive Items")
|
||||||
erpnext.patches.v11_1.delete_scheduling_tool
|
erpnext.patches.v11_1.delete_scheduling_tool
|
||||||
execute:frappe.delete_doc_if_exists("Page", "support-analytics")
|
|
||||||
erpnext.patches.v12_0.rename_tolerance_fields
|
erpnext.patches.v12_0.rename_tolerance_fields
|
||||||
erpnext.patches.v12_0.make_custom_fields_for_bank_remittance #14-06-2019
|
erpnext.patches.v12_0.make_custom_fields_for_bank_remittance #14-06-2019
|
||||||
execute:frappe.delete_doc_if_exists("Page", "support-analytics")
|
execute:frappe.delete_doc_if_exists("Page", "support-analytics")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user