Will this fix this kind of use case?
https://discuss.frappe.io/t/override-print-doc-in-form-js/104767