mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
Merge pull request #18791 from Mangesh-Khairnar/fix-ledger-entry
fix: ledger entries
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
"options": "Employee"
|
"options": "Employee"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"fetch_from": "employee.employee_name",
|
||||||
"fieldname": "employee_name",
|
"fieldname": "employee_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Employee Name"
|
"label": "Employee Name"
|
||||||
@@ -101,7 +102,7 @@
|
|||||||
],
|
],
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-06-21 00:37:07.782810",
|
"modified": "2019-08-20 14:40:04.130799",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Ledger Entry",
|
"name": "Leave Ledger Entry",
|
||||||
|
|||||||
@@ -97,16 +97,15 @@ def get_approvers(department):
|
|||||||
|
|
||||||
def get_total_allocated_leaves(employee, leave_type, from_date, to_date):
|
def get_total_allocated_leaves(employee, leave_type, from_date, to_date):
|
||||||
''' Returns leave allocation between from date and to date '''
|
''' Returns leave allocation between from date and to date '''
|
||||||
filters= {
|
leave_allocation_records = frappe.db.get_all('Leave Ledger Entry', filters={
|
||||||
'from_date': ['between', (from_date, to_date)],
|
'docstatus': 1,
|
||||||
'to_date': ['between', (from_date, to_date)],
|
'is_expired': 0,
|
||||||
'docstatus': 1,
|
'leave_type': leave_type,
|
||||||
'is_expired': 0,
|
'employee': employee,
|
||||||
'leave_type': leave_type,
|
'transaction_type': 'Leave Allocation'
|
||||||
'employee': employee,
|
}, or_filters={
|
||||||
'transaction_type': 'Leave Allocation'
|
'from_date': ['between', (from_date, to_date)],
|
||||||
}
|
'to_date': ['between', (from_date, to_date)]
|
||||||
|
}, fields=['SUM(leaves) as leaves'])
|
||||||
leave_allocation_records = frappe.db.get_all('Leave Ledger Entry', filters=filters, fields=['SUM(leaves) as leaves'])
|
|
||||||
|
|
||||||
return flt(leave_allocation_records[0].get('leaves')) if leave_allocation_records else flt(0)
|
return flt(leave_allocation_records[0].get('leaves')) if leave_allocation_records else flt(0)
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate, today
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
""" Generates leave ledger entries for leave allocation/application/encashment
|
""" Generates leave ledger entries for leave allocation/application/encashment
|
||||||
@@ -66,7 +66,8 @@ def generate_expiry_allocation_ledger_entries():
|
|||||||
if not frappe.db.exists("Leave Ledger Entry", {'transaction_type': 'Leave Allocation', 'transaction_name': allocation.name, 'is_expired': 1}):
|
if not frappe.db.exists("Leave Ledger Entry", {'transaction_type': 'Leave Allocation', 'transaction_name': allocation.name, 'is_expired': 1}):
|
||||||
allocation.update(dict(doctype="Leave Allocation"))
|
allocation.update(dict(doctype="Leave Allocation"))
|
||||||
allocation_obj = frappe.get_doc(allocation)
|
allocation_obj = frappe.get_doc(allocation)
|
||||||
expire_allocation(allocation_obj)
|
if allocation_obj.to_date <= getdate(today()):
|
||||||
|
expire_allocation(allocation_obj)
|
||||||
|
|
||||||
def get_allocation_records():
|
def get_allocation_records():
|
||||||
return frappe.get_all("Leave Allocation", filters={
|
return frappe.get_all("Leave Allocation", filters={
|
||||||
|
|||||||
Reference in New Issue
Block a user