Cannot customise form "Salary Slip" when adding Option "Holiday List"

Dear all,
I want to access all holidays in the one and only Holiday List from Salary Slip, so I customise the form “Salary Slip”.

When I try to update the form after adding Holiday List as Option, it says:

Option Holiday List for field holiday_list is not a child table.

How can I fix this? Much much thanks!

Can anyone give me some pointers?

For adding a table you need a doctype setup as a Child Doctype.

Since there is already a doctype called Holiday List which is not a child doctype aka a table in Frappe/ERPNext parlance, you’re getting this error.

https://frappeframework.com/docs/v13/user/en/basics/doctypes/child-doctype

https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/articles/customizing-data-visibility-in-child-table

@kennethsequeira, very very appreciative of your advice.

If I customise Holiday List, and make the needed changes (by following the docs you just gave me), would it break this part of the ERPNext?

You can’t/shouldn’t customize existing doctypes to tables.

You’ll need to create a new child table doctype and then make the required customizations around it.

I see.

Similarly I need to retrieve Timesheet’s start_date and end_date and place them into Salary Structure too. So I guess I’ll also need to do the same thing.

Wow, that means I need to clone 2 doctypes (Holiday List and Timesheet), change them to child doctype, and use it from there. Am I on the right path?

You don’t need to duplicate the whole doctype.

You just need the specific fields that you want to show/need. Once you link the right record in each row of the table, you’ll be able to fetch required data easily or traverse back to the main records to fetch data as and when appropriate.

Since you’re jumping into customizations, I suggest going through the tutorial on building apps so the basics of the framework become clear. This is a bit old, but should make the process easier.

You can also refer the docs.

1 Like

Nice. Thank you @kennethsequeira

@kennethsequeira I’m trying to do Timesheet’s start_date and end_date first. However, Salary Structure’s doctype already has start_date and end_date.

How should I reference it when I’m adding new Row in Salary Structure? Mustn’t the Name field be “start_date” and “end_date” again, so that ERPNext know’s it is Timesheet’s start_date and end_date?

When I do this, the variable in PyCharm is None, which is expected.

48%20PM

@kennethsequeira do you have any suggestions? :pray:t3:

Please please please. Can someone help me and share pointers?

Let me re-cap what we need to achieve.

For all timesheets, there is the start_date and end_date. We want to use start_date and end_date in Salary Structure’s Formula. How do we use it? We want to have access to both values when we create Salary Slip. We want both values to match what’s in the company holidays. If a match is found (that is, the start_date and end_date is one of the holidays), then formula will be AAAAA, else will be BBBB.

Basically AAAA will result a Basic (Salary Component) value - the wage for holiday, while BBBB will result another Basic value - the wage for normal day.

Or should I use Custom Script for this computation?

Or there is another way to get this configuration done?

I’m pretty new to ERPNext, so I would appreciate if someone can give me some concrete directions/approach.

Anyone be kind enough to help? Is this my understanding on this wrong?

Much much thx in advance!