mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
[Mod] Ensured that a single POS Sales Invoice is created even when its printed(saved) in Draft mode
This commit is contained in:
@@ -278,13 +278,17 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
submit_sales_invoice() {
|
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.confirm(__("Permanently Submit {0}?", [this.frm.doc.name]), () => {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'erpnext.selling.page.point_of_sale.point_of_sale.submit_invoice',
|
method: 'erpnext.selling.page.point_of_sale.point_of_sale.submit_invoice',
|
||||||
freeze: true,
|
freeze: true,
|
||||||
args: {
|
args: {
|
||||||
doc: this.frm.doc
|
doc: this.frm.doc,
|
||||||
|
islocal_dummy: islocal_dummy
|
||||||
}
|
}
|
||||||
}).then(r => {
|
}).then(r => {
|
||||||
if(r.message) {
|
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) {
|
if (this.frm.doc.docstatus == 1) {
|
||||||
|
this.page.set_primary_action(__("New"), () => {
|
||||||
|
this.make_new_invoice();
|
||||||
|
});
|
||||||
this.page.add_menu_item(__("Email"), () => {
|
this.page.add_menu_item(__("Email"), () => {
|
||||||
this.frm.email_doc();
|
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
|
return '%%%s%%'%(frappe.db.escape(item_code)), condition
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def submit_invoice(doc):
|
def submit_invoice(doc,islocal_dummy):
|
||||||
if isinstance(doc, basestring):
|
if isinstance(doc, basestring):
|
||||||
args = json.loads(doc)
|
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.update(args)
|
||||||
doc.run_method("set_missing_values")
|
doc.run_method("set_missing_values")
|
||||||
doc.run_method("calculate_taxes_and_totals")
|
doc.run_method("calculate_taxes_and_totals")
|
||||||
|
|||||||
Reference in New Issue
Block a user