Need Help for Custom raise material request Workflow

Dear Sir,

Recently me and my team are trying to change the workflow of Material request by creating a workaround on material request flow.

We
would like to change the “Create Material Request” trigger inside the
“Production Planning Tool” doctype in the “Manufacturing” section.

We
tried our “custom script” so that when the “create material request”
are being triggered, the function doesnt go to "raise_material_request
function in the “production_planning_tool.py” however that the function
would go somewhere else lets say at our custom created “custom_extra.py”

We have tried our custom script as bellow: on the production planning tool doctype - custom script. ::

frappe.ui.form.on(“Production Planning Tool”, {
create_material_requests: function(frm) {
frappe.call({
doc: frm.doc,
method: “erpnext.manufacturing.doctype.extra.raise_material_requests”
});
}
})

We
tried this script however the trigger of the “raise_material_request”
function will always go to the original “production_planning_tool.py”
file

do you have any better idea to implement this?

Thanks and best regards
Anton

@tara_antonius take a special look in the Hooks documentation, they are able of cover your requirements https://frappe.github.io/frappe/user/en/guides/basics/hooks.html