Generate stock ledger for custom doctype

Dears,
I want to create a custom doctype linked with child doctype.
on submit I need to affect the stock balance and valuation rate for the items listed in the child doctype
I need to know how can I add script that will generate stock ledger after submitting the doctype
Thanks

I would suggest to add custom script in stock entry doctype depending on your usecase…but if you want to totally create custom doctype then you need to know how stock controller works very well and your custom doctype must inherit from it…

Thank you dear for your reply
I hope if you can give me an idea about how can I inherit the custom doctype from the stock controller ?