Revert "fix: process allocation expiry"
This reverts commit b654dc0e288e3ecfdfbd0831c3ae15cc7036bb90.
This commit is contained in:
parent
dbc69da409
commit
42d0da8f5a
@ -95,28 +95,29 @@ def process_expired_allocation():
|
|||||||
'expire_carry_forwarded_leaves_after_days': (">", 0)
|
'expire_carry_forwarded_leaves_after_days': (">", 0)
|
||||||
}, fieldname=['name'])
|
}, fieldname=['name'])
|
||||||
|
|
||||||
leave_type = [record[0] for record in leave_type_records]
|
if leave_type_records:
|
||||||
|
leave_type = [record[0] for record in leave_type_records]
|
||||||
|
|
||||||
expired_allocation = frappe.db.sql_list("""SELECT name
|
expired_allocation = frappe.db.sql_list("""SELECT name
|
||||||
FROM `tabLeave Ledger Entry`
|
FROM `tabLeave Ledger Entry`
|
||||||
WHERE
|
WHERE
|
||||||
`transaction_type`='Leave Allocation'
|
`transaction_type`='Leave Allocation'
|
||||||
AND `is_expired`=1""")
|
AND `is_expired`=1""")
|
||||||
|
|
||||||
expire_allocation = frappe.get_all("Leave Ledger Entry",
|
expire_allocation = frappe.get_all("Leave Ledger Entry",
|
||||||
fields=['leaves', 'to_date', 'employee', 'leave_type', 'is_carry_forward', 'transaction_name as name', 'transaction_type'],
|
fields=['leaves', 'to_date', 'employee', 'leave_type', 'is_carry_forward', 'transaction_name as name', 'transaction_type'],
|
||||||
filters={
|
filters={
|
||||||
'to_date': ("<", today()),
|
'to_date': ("<", today()),
|
||||||
'transaction_type': 'Leave Allocation',
|
'transaction_type': 'Leave Allocation',
|
||||||
'transaction_name': ('not in', expired_allocation)
|
'transaction_name': ('not in', expired_allocation)
|
||||||
},
|
},
|
||||||
or_filters={
|
or_filters={
|
||||||
'is_carry_forward': 0,
|
'is_carry_forward': 0,
|
||||||
'leave_type': ('in', leave_type)
|
'leave_type': ('in', leave_type)
|
||||||
})
|
})
|
||||||
|
|
||||||
if expire_allocation:
|
if expire_allocation:
|
||||||
create_expiry_ledger_entry(expire_allocation)
|
create_expiry_ledger_entry(expire_allocation)
|
||||||
|
|
||||||
def create_expiry_ledger_entry(allocations):
|
def create_expiry_ledger_entry(allocations):
|
||||||
''' Create ledger entry for expired allocation '''
|
''' Create ledger entry for expired allocation '''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user