New Doc Type Fields Not recognised in Salary components

Hi All,

I Have created a doc type called over time and added fields called

  1. Employee ID
  2. Employee Name
    3)Salary Month
    4)OT Days for the month

To calculate OT in my Salary component i have created salary component called Over Time
Where i have given condition as “posting_date == doc.salary_month”
and calculation formula as (base / total_working_days) * doc.ot_days_for_the_month

How ever while i was executing the payroll i am getting error message as shown in below mentioned image.

As per the error message i understood that doctype is not getting recognised by system.

Kindly help me how to resolve the issue.

Thanks in advance.

@buildwithhussain can you please help me out on this issue.

can you share your code?

I haven’t added any code, I have just created a Doctype called Over Time with following fields.
1)Employee ID
2) Employee Name
3)Salary Month
4)OT Days for the month.

Then i have entered a record into the doctype. After that i have created a salary component called Over Time for calculation of Over Time days.

The Salary Component configurations are

In Condition i have given : posting_date == doc.salary_month

and in formula i have given formula as (base / total_working_days) * doc.ot_days_for_the_month

However while generating payroll i am getting above mentioned error.

Please help me out to resolve the issue. As New doctype is unidentifiable in salary component.

@buildwithhussain, @flexy2ky can you help me on this ?

doc here will refer to the Current doctype not to your Over Time doctype
However, you can solve your issue using Additional Salary doctype which reflect the amount of overtime days on the salary slip

@OmarJaber is there any other way i can use the formula as these are recurring entries which needs to be managed. Also in Additional Salary doctype We need to enter the amount manually every time which is time consuming. Can you suggest any simpler way to resolve the issue.

the salary structure is made once, and to update the monthly salary by increasing or decreasing you will need to use the Additional Salary
but if you want to set this value for each employee you can add them as custom field from customize form in employee doctype and in the formula you can use them directly
like this:
posting_date == salary_month
but each field should be exists in employee doctype