[Mod] Ensured that a single POS Sales Invoice is created even when its printed(saved) in Draft mode
This commit is contained in:
parent
1ccb0cfa2f
commit
cc813d2286
@ -278,13 +278,17 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
}
|
||||
|
||||
submit_sales_invoice() {
|
||||
|
||||
var islocal_dummy = 1;
|
||||
if(!this.frm.doc.__islocal){
|
||||
islocal_dummy = 0;
|
||||
}
|
||||
frappe.confirm(__("Permanently Submit {0}?", [this.frm.doc.name]), () => {
|
||||
frappe.call({
|
||||
method: 'erpnext.selling.page.point_of_sale.point_of_sale.submit_invoice',
|
||||
freeze: true,
|
||||
args: {
|
||||
doc: this.frm.doc
|
||||
doc: this.frm.doc,
|
||||
islocal_dummy: islocal_dummy
|
||||
}
|
||||
}).then(r => {
|
||||
if(r.message) {
|
||||
@ -527,12 +531,11 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.page.set_primary_action(__("New"), () => {
|
||||
this.make_new_invoice();
|
||||
});
|
||||
|
||||
|
||||
if (this.frm.doc.docstatus == 1) {
|
||||
this.page.set_primary_action(__("New"), () => {
|
||||
this.make_new_invoice();
|
||||
});
|
||||
this.page.add_menu_item(__("Email"), () => {
|
||||
this.frm.email_doc();
|
||||
});
|
||||
|
@ -88,11 +88,15 @@ def get_conditions(item_code, serial_no, batch_no, barcode):
|
||||
return '%%%s%%'%(frappe.db.escape(item_code)), condition
|
||||
|
||||
@frappe.whitelist()
|
||||
def submit_invoice(doc):
|
||||
def submit_invoice(doc,islocal_dummy):
|
||||
if isinstance(doc, basestring):
|
||||
args = json.loads(doc)
|
||||
|
||||
doc = frappe.new_doc('Sales Invoice')
|
||||
if islocal_dummy:
|
||||
doc = frappe.get_doc('Sales Invoice',args["name"])
|
||||
else:
|
||||
doc = frappe.new_doc('Sales Invoice')
|
||||
|
||||
doc.update(args)
|
||||
doc.run_method("set_missing_values")
|
||||
doc.run_method("calculate_taxes_and_totals")
|
||||
|
Loading…
x
Reference in New Issue
Block a user