Multiple changes:
[Mod] Used async-await for asynchronous save in draft mode [Fix] Fixed bug that din't allow to submit a new POS Invoice
This commit is contained in:
parent
c5a6cf3a0e
commit
a2076a1ff0
@ -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){
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user