mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
fix: only create leave application ledger on intermediate allocation expiry
This commit is contained in:
@@ -370,18 +370,19 @@ class LeaveApplication(Document):
|
|||||||
''' splits leave application into two ledger entries to consider expiry of allocation '''
|
''' splits leave application into two ledger entries to consider expiry of allocation '''
|
||||||
args = dict(
|
args = dict(
|
||||||
from_date=self.from_date,
|
from_date=self.from_date,
|
||||||
to_date=self.to_date,
|
to_date=expiry_date,
|
||||||
leaves=(date_diff(expiry_date, self.from_date) + 1) * -1
|
leaves=(date_diff(expiry_date, self.from_date) + 1) * -1
|
||||||
)
|
)
|
||||||
create_leave_ledger_entry(self, args, submit)
|
create_leave_ledger_entry(self, args, submit)
|
||||||
|
|
||||||
start_date = add_days(expiry_date, 1)
|
if expiry_date != self.to_date:
|
||||||
args.update(dict(
|
start_date = add_days(expiry_date, 1)
|
||||||
from_date=start_date,
|
args.update(dict(
|
||||||
to_date=self.to_date,
|
from_date=start_date,
|
||||||
leaves=date_diff(self.to_date, expiry_date) * -1
|
to_date=self.to_date,
|
||||||
))
|
leaves=date_diff(self.to_date, expiry_date) * -1
|
||||||
create_leave_ledger_entry(self, args, submit)
|
))
|
||||||
|
create_leave_ledger_entry(self, args, submit)
|
||||||
|
|
||||||
def get_allocation_expiry(employee, leave_type, to_date, from_date):
|
def get_allocation_expiry(employee, leave_type, to_date, from_date):
|
||||||
expiry = frappe.get_all("Leave Ledger Entry",
|
expiry = frappe.get_all("Leave Ledger Entry",
|
||||||
|
|||||||
Reference in New Issue
Block a user