In Purchase Order Doctype js file, i want to add a button “Action” with Dropdown say “A” & “B”, since directly changing the core files is bad practice, i want to do it through Hooks
i did below steps but failed
-
created a file “purchase_order_custom.js”, and stored in custom_app–>public–>js–>purchase_order_custom.js (see below image to exactly find where i created the file)
-
in the file tried two codes just to see does this code even get hit or not (not added exact functionality b/z first i wanted to see does this work or not)
a)
frappe.ui.form.on('Purchase Order', {
supplier: function(frm) {
frappe.msgprint("Supplier has been selected!");
}
});
b)
class CustomPurchaseOrder extends frappe.ui.form.PurchaseOrder {
supplier(){
frappe.msgprint("HHHHHHHHHHHHHHHHHHHHhh");
}
}
frappe.ui.form.PurchaseOrder = CustomPurchaseOrder;
- added this in Hooks.py of custom app
app_include_js = “/assets/embee/public/js/purchase_order_custom.js”
please anyone help, i am stuck in this problem from a long time
can’t find an exact solution in similar question asked on forum