diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index a7e16afa785..29238ea8058 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -279,9 +279,9 @@ erpnext.pos.PointOfSale = class PointOfSale { } submit_sales_invoice() { - var islocal_dummy = 1; + var is_saved = 0; if(!this.frm.doc.__islocal){ - islocal_dummy = 0; + is_saved = 1; } frappe.confirm(__("Permanently Submit {0}?", [this.frm.doc.name]), () => { frappe.call({ @@ -289,7 +289,7 @@ erpnext.pos.PointOfSale = class PointOfSale { freeze: true, args: { doc: this.frm.doc, - islocal_dummy: islocal_dummy + is_saved: is_saved } }).then(r => { if(r.message) { @@ -505,13 +505,11 @@ erpnext.pos.PointOfSale = class PointOfSale { set_form_action() { if(this.frm.doc.docstatus == 1 || (this.frm.doc.allow_print_before_pay == 1&&this.frm.doc.items.length>0)){ - this.page.set_secondary_action(__("Print"), () => { + this.page.set_secondary_action(__("Print"), async() => { if(this.frm.doc.docstatus != 1 ){ - this.frm.save(); - setTimeout(() => {this.frm.print_preview.printit(true);}, 1700); - }else{ - this.frm.print_preview.printit(true); + await this.frm.save(); } + this.frm.print_preview.printit(true); }); } if(this.frm.doc.items.length == 0){ diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py index 9389188d429..938c05d31ad 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.py +++ b/erpnext/selling/page/point_of_sale/point_of_sale.py @@ -88,11 +88,11 @@ def get_conditions(item_code, serial_no, batch_no, barcode): return '%%%s%%'%(frappe.db.escape(item_code)), condition @frappe.whitelist() -def submit_invoice(doc,islocal_dummy): +def submit_invoice(doc,is_saved): if isinstance(doc, basestring): args = json.loads(doc) - if islocal_dummy: + if(is_saved == 1): doc = frappe.get_doc('Sales Invoice',args["name"]) else: doc = frappe.new_doc('Sales Invoice')