Onchange function

May I know how to do this onchange function in ERPNext.
This function has been in odoo13.

def onchange_autofill(self):
    if self.autofill:
        product_categories = self.env['product.category'].search([('parent_id', '!=', False)])
        annual_point_scheme_lines = []
        for category in product_categories:
            annual_point_scheme_lines.append((0, 0, {'categ_id': category.id, 'point_assigned': 1}))

        self.annual_point_scheme_lines = annual_point_scheme_lines

Hi @Kavitha,

Please, Do not compare erpnext with odoo.
both are different platforms, different methods, and events.
Form Script:-> Form Scripts


ok @NCP In ERPNext how to do
Child Table Main=> click Add row=> child Table 1 => click Add row=> child Table 2

Please do not tag forum Users in threads, unless they were already participating in the conversation. This is considered impolite behavior.

Instead, ask your questions. Then discuss with the people that choose to participate.

Remember, everyone is a volunteer here.

If you want to have a conversation with a specific person, then send them a DM, and ask them if it’s okay to chat in private. Otherwise, use another platform for person-to-person conversations.