How to Add Rows to Item Table on Sales Invoice Using JavaScript

I’m facing an issue while trying to add rows to the item table on a sales invoice using JavaScript. I’ve attempted to use the add_child method, but it doesn’t automatically fetch the rate and amount, among other things.

My objective is to dynamically add sales invoice items through JavaScript, ensuring that all necessary fields, such as rate and amount, are properly populated.

1

Thank you for your help!

share the code, if anyone has a solution then will provide you.

@NCP
I’m working on a scenario where customers subscribe to products on a daily basis, and at the end of the month, I need to generate a sales invoice based on the total quantity of items subscribed. To achieve this, I’ve created a custom doctype called ‘Daily Item Subscription’. In this doctype, I link the customer, item, quantity, and delivery period.


Additionally, I’ve added a custom button called ‘Create Sales Invoice’. When clicked, this button prompts the user to enter the start and end dates for creating the sales invoice. The system then calculates the total quantity of items subscribed over the specified period and generates a new sales invoice accordingly.