Merge pull request #23082 from ruchamahabal/fix-pos-print-v12

fix: Print Language for Customer not set for POS Invoice
This commit is contained in:
rohitwaghchaure
2020-08-24 16:11:26 +05:30
committed by GitHub

View File

@@ -436,7 +436,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
set_primary_action_in_modal() { set_primary_action_in_modal() {
if (!this.frm.msgbox) { if (!this.frm.msgbox) {
this.frm.msgbox = frappe.msgprint( this.frm.msgbox = frappe.msgprint(
`<a class="btn btn-primary" onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;"> `<a class="btn btn-primary" style="margin-right: 5px;">
${__('Print')}</a> ${__('Print')}</a>
<a class="btn btn-default"> <a class="btn btn-default">
${__('New')}</a>` ${__('New')}</a>`
@@ -445,7 +445,15 @@ erpnext.pos.PointOfSale = class PointOfSale {
$(this.frm.msgbox.body).find('.btn-default').on('click', () => { $(this.frm.msgbox.body).find('.btn-default').on('click', () => {
this.frm.msgbox.hide(); this.frm.msgbox.hide();
this.make_new_invoice(); this.make_new_invoice();
}) });
$(this.frm.msgbox.body).find('.btn-primary').on('click', () => {
this.frm.msgbox.hide();
const frm = this.events.get_frm();
frm.doc = this.doc;
frm.print_preview.lang_code = frm.doc.language;
frm.print_preview.printit(true);
});
} }
} }
@@ -680,7 +688,10 @@ erpnext.pos.PointOfSale = class PointOfSale {
if(this.frm.doc.docstatus != 1 ){ if(this.frm.doc.docstatus != 1 ){
await this.frm.save(); await this.frm.save();
} }
this.frm.print_preview.printit(true); const frm = this.events.get_frm();
frm.doc = this.doc;
frm.print_preview.lang_code = frm.doc.language;
frm.print_preview.printit(true);
}); });
} }
if(this.frm.doc.items.length == 0){ if(this.frm.doc.items.length == 0){