Hi all,
Happy New Year.
Wonder if anyone has tried this… I have a custom button created on Sales Order or in other doctype with a custom field SALESINVOICE.
Now how can i print using the code which is not working…
frm.add_custom_button(__('Sales Invoice'), function() {
cur_frm.reload_doc();
//TESTING
//frappe.model.with_doctype('Sales Invoice', function(){
frappe.model.with_doc('Sales Invoice',cur_frm.doc.sales_invoice, function(){
//frappe.get_meta('Sales Invoice');
var d = frappe.model.get_doc('Sales Invoice',cur_frm.doc.sales_invoice);
console.log('tenta imprimir');
frappe.route_options = {
frm: d,
print_format_list : ['Standard'],
};
frappe.set_route('print', d.doctype, d.name);
//d.print_doc();
});
});
Anyone to see what is wrong because when running returns the error “Cannot read properties of undefined (reading ‘module’)” on
set_breadcrumbs() {
frappe.breadcrumbs.add(this.frm.meta.module, this.frm.doctype);
}
Because this.frm.meta is not available.
Thanks in advance