Hello,
Is there a way to globally override/extend the frm.print_doc()
located in frappe/public/js/form/form.js
I want to override it with a new one and I want the new one to be called instead of frm.print_doc()
whenever it is called.
so far this is what I have done.
custom code in public/js/overrides.js
you can find other things I tried commented.
frappe.provide("frappe.form");
// const overrides = frappe.form.extend({
// // calculate_item_values is function you want to override
// print_doc: function() {
// console.log('Hello from extend taxes and total extend !!');
// },
// });
// $.extend(frappe.form, {
// print_doc: function() {
// console.log('Hello from extend taxes and total extend !!');
// }
// });
frappe.ui.form.Form = Class.extend({
print_doc: function() {
console.log('Hello from extend taxes and total extend !!');
}
});
frappe.print_doc = bhc_advanced.print_doc;
build.json
{
"css/custom_printview.min.css": [
"public/css/printview2.css",
"public/scss/custom.scss"
],
"js/custom_list.min.js": ["public/html/print_template.html"],
"js/custom_form.min.js": [
"public/js/overrides.js"
]
}
hooks.py
app_include_js = [
"/assets/js/custom_list.min.js"
"/assets/js/custom_form.min.js",
]