Script for child documents

Hi,
I’m trying to add a custom script in erpnext, but it doesn’t work.
Thi script has to be activated when the Purchase Receipt Item window is shown and manipulate some data fields of this form.
I read in the manual, that for Child DocType the script event has to be linked to parent doctype, so I create a script on document Purchase Receipt.

and this is the code:

frappe.ui.form.on(‘Purchase Receipt Item’, {
onload: function(frm) {

console.log(“test”);
}
});

Any suggestion?

I found in another post the solution.

frappe.ui.form.on(“Purchase Receipt”, {
“items_on_form_rendered”: function(frm) {

console.log(“test”);
}
});

the “[items]_on_form_rendered” is:

items = is the name of table field in Purchase Receipt doc type.

2 Likes

if it solves your problem then mark it as solution