Merge pull request #24005 from Anurag810/leave_ledger_patch
fix: ignore exception during leave ledger creation from patch
This commit is contained in:
commit
8b6c58d560
@ -376,24 +376,32 @@ class LeaveApplication(Document):
|
|||||||
if expiry_date:
|
if expiry_date:
|
||||||
self.create_ledger_entry_for_intermediate_allocation_expiry(expiry_date, submit, lwp)
|
self.create_ledger_entry_for_intermediate_allocation_expiry(expiry_date, submit, lwp)
|
||||||
else:
|
else:
|
||||||
|
raise_exception = True
|
||||||
|
if frappe.flags.in_patch:
|
||||||
|
raise_exception=False
|
||||||
|
|
||||||
args = dict(
|
args = dict(
|
||||||
leaves=self.total_leave_days * -1,
|
leaves=self.total_leave_days * -1,
|
||||||
from_date=self.from_date,
|
from_date=self.from_date,
|
||||||
to_date=self.to_date,
|
to_date=self.to_date,
|
||||||
is_lwp=lwp,
|
is_lwp=lwp,
|
||||||
holiday_list=get_holiday_list_for_employee(self.employee)
|
holiday_list=get_holiday_list_for_employee(self.employee, raise_exception=raise_exception) or ''
|
||||||
)
|
)
|
||||||
create_leave_ledger_entry(self, args, submit)
|
create_leave_ledger_entry(self, args, submit)
|
||||||
|
|
||||||
def create_ledger_entry_for_intermediate_allocation_expiry(self, expiry_date, submit, lwp):
|
def create_ledger_entry_for_intermediate_allocation_expiry(self, expiry_date, submit, lwp):
|
||||||
''' splits leave application into two ledger entries to consider expiry of allocation '''
|
''' splits leave application into two ledger entries to consider expiry of allocation '''
|
||||||
|
|
||||||
|
raise_exception = True
|
||||||
|
if frappe.flags.in_patch:
|
||||||
|
raise_exception=False
|
||||||
|
|
||||||
args = dict(
|
args = dict(
|
||||||
from_date=self.from_date,
|
from_date=self.from_date,
|
||||||
to_date=expiry_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,
|
||||||
is_lwp=lwp,
|
is_lwp=lwp,
|
||||||
holiday_list=get_holiday_list_for_employee(self.employee),
|
holiday_list=get_holiday_list_for_employee(self.employee, raise_exception=raise_exception) or ''
|
||||||
|
|
||||||
)
|
)
|
||||||
create_leave_ledger_entry(self, args, submit)
|
create_leave_ledger_entry(self, args, submit)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user