How to auto update/ calculate Leave Encashment Amount Per Day amount in salary structure after assigning base in Salary Structure Assignment

Hello Everyone,
I have to auto calculate Leave Encashment Amount Per Day field in salary structure. When i submit Salary Structure Assignment
then based on base value field the per day amount should get changed in Salary Structure.

As shown in above image i need to update value of leave encashment amount per day field manually. I
I have to calculate by formula :
leave_encashment_amount_per_day = (base / total_working_day)

Thanks in advance

hello @NCP,
Can you please provide me support for this issue.


But where is defined total_working_day?

or manually set will total_working_day as a 30 Day

or can you define total_working_day in Salary Structure/Salary Structure Assignment


Hello @NCP,
I have to apply formula on leave encashment amount Per day field like :

leave_encashment_amount_per_day = base / 26

when i submit salary structure assignment that time according to base field, value of the Leave Encashment amount per day field get update.

Hi @Shraddha33,

Give me some time, i will try it.

Thank You!

Hi @Shraddha33,

But facing an issue like Not being allowed to change Leave Encashment Amount Per Day after submission in Salary Slip.

So first you define a custom field in Salary Slip then I pass the Value.
Is it possible?

Thank You!

no problem,

but which field should i create

Hi @Shraddha33,

Make float field in Salary Slip as your according.
It will not happen set in Leave Encashment Amount Per Day.


No problem
Thanks for Support :slight_smile:

Hi @Shraddha33,

If in the future add a custom field then apply the server script.

test_name = frappe.db.get_value("Salary Structure",{'name':doc.salary_structure},'name')
if test_name:
    test_doc = frappe.get_doc("Salary Structure",test_name)
    test_doc.leapd = doc.base / 26

Thank You!