After enabling online pos, I was not able to use offline pos print format which is of type ‘Js’ (Print Format Type) in online mode. Nothing is being displayed when i try to print from online pos.
Tried to debug at code level in pos and found two different js files for online (point_of_sale.js) and offline (pos.js) mode. Further digging deeper at (pos_profile.js) and encounter below code which i assume makes Js format not available for online mode.
Please correct me if i am wrong.
frm.set_query("online_print_format", function() { return { filters: [ ['Print Format', 'doc_type', '=', 'Sales Invoice'], ['Print Format', 'print_format_type', '!=', 'Js'], ] }; }); frm.set_query("print_format", function() { return { filters: { doc_type: "Sales Invoice", print_format_type: "Js"} }; });
Also, i saw two different ways of rendering print format.
"Offline Mode"
this.page.set_secondary_action(__("Print"), function () {
var html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
"Online Mode"
this.page.set_secondary_action(__("Print"), () => {
if (this.pos_profile && this.pos_profile.print_format_for_online) {
this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
}
this.frm.print_preview.printit(true);
});
Curious to know how online mode is rendering print format?
So, the question is how could we use offline POS Print format (Type - Js) for online mode?