From e259a9b068ba4441929ebdb49a15e4ad98654581 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 14 Mar 2017 19:03:49 +0530 Subject: [PATCH] [fix] User sales one serial number multiple time from the POS --- erpnext/accounts/page/pos/pos.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index b86f9e15bb..1dafb87c3a 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -1413,11 +1413,30 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ submit_invoice: function () { var me = this; this.change_status(); + this.update_serial_no() if (this.frm.doc.docstatus == 1) { this.print_dialog() } }, + update_serial_no: function() { + var me = this; + + //Remove the sold serial no from the cache + $.each(this.frm.doc.items, function(index, data) { + sn = data.serial_no.split('\n') + if(sn.length) { + serial_no_list = me.serial_no_data[data.item_code] + $.each(sn, function(i, serial_no) { + if(in_list(Object.keys(serial_no_list), serial_no)) { + delete serial_no_list[serial_no] + } + }) + me.serial_no_data[data.item_code] = serial_no_list; + } + }) + }, + change_status: function () { if (this.frm.doc.docstatus == 0) { this.frm.doc.docstatus = 1;