[Fix] batch no searching in pos
This commit is contained in:
parent
62658fde45
commit
a88dec8775
@ -20,7 +20,7 @@ def get_pos_data():
|
|||||||
if pos_profile.get('name'):
|
if pos_profile.get('name'):
|
||||||
pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name'))
|
pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name'))
|
||||||
else:
|
else:
|
||||||
frappe.msgprint('<a href="#Form/POS Profile/New POS Profile">'
|
frappe.msgprint('<a href="#List/POS Profile">'
|
||||||
+ _("Welcome to POS: Create your POS Profile") + '</a>');
|
+ _("Welcome to POS: Create your POS Profile") + '</a>');
|
||||||
|
|
||||||
update_pos_profile_data(doc, pos_profile)
|
update_pos_profile_data(doc, pos_profile)
|
||||||
@ -115,7 +115,7 @@ def get_items(doc, pos_profile):
|
|||||||
item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
|
item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
|
||||||
'warehouse': item.default_warehouse}, 'actual_qty') or 0
|
'warehouse': item.default_warehouse}, 'actual_qty') or 0
|
||||||
item.serial_nos = get_serial_nos(item, pos_profile)
|
item.serial_nos = get_serial_nos(item, pos_profile)
|
||||||
item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where expiry_date > curdate()
|
item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where ifnull(expiry_date, '4000-10-10') > curdate()
|
||||||
and item = %(item_code)s""", {'item_code': item.item_code})
|
and item = %(item_code)s""", {'item_code': item.item_code})
|
||||||
|
|
||||||
item_list.append(item)
|
item_list.append(item)
|
||||||
|
@ -423,7 +423,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
if(key){
|
if(key){
|
||||||
return $.grep(window.items, function(item){
|
return $.grep(window.items, function(item){
|
||||||
if( (item.item_code.toLowerCase().match(key)) ||
|
if(in_list(item.batch_nos, me.search.$input.val())){
|
||||||
|
return me.item_batch_no[item.item_code] = me.search.$input.val()
|
||||||
|
} else if((item.item_code.toLowerCase().match(key)) ||
|
||||||
(item.item_name.toLowerCase().match(key)) || (item.item_group.toLowerCase().match(key))){
|
(item.item_name.toLowerCase().match(key)) || (item.item_group.toLowerCase().match(key))){
|
||||||
return true
|
return true
|
||||||
}else if(item.barcode == me.search.$input.val()){
|
}else if(item.barcode == me.search.$input.val()){
|
||||||
@ -431,8 +433,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
} else if (in_list(Object.keys(item.serial_nos), me.search.$input.val())){
|
} else if (in_list(Object.keys(item.serial_nos), me.search.$input.val())){
|
||||||
me.item_serial_no[item.item_code] = [me.search.$input.val(), item.serial_nos[me.search.$input.val()]]
|
me.item_serial_no[item.item_code] = [me.search.$input.val(), item.serial_nos[me.search.$input.val()]]
|
||||||
return true
|
return true
|
||||||
} else if(in_list(item.batch_nos, me.search.$input.val())){
|
|
||||||
return me.item_batch_no[item.item_code] = me.search.$input.val()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
@ -31,7 +31,6 @@ frappe.ui.form.on("Timesheet", {
|
|||||||
|
|
||||||
onload: function(frm){
|
onload: function(frm){
|
||||||
if (frm.doc.__islocal && frm.doc.time_logs) {
|
if (frm.doc.__islocal && frm.doc.time_logs) {
|
||||||
frm.set_value("employee", "")
|
|
||||||
calculate_time_and_amount(frm);
|
calculate_time_and_amount(frm);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -582,7 +582,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
set_default_payment: function(total_amount_to_pay, update_paid_amount){
|
set_default_payment: function(total_amount_to_pay, update_paid_amount){
|
||||||
var me = this;
|
var me = this;
|
||||||
payment_status = true;
|
payment_status = true;
|
||||||
if(this.frm.doc.is_pos && (!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount)){
|
if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
|
||||||
$.each(this.frm.doc['payments'] || [], function(index, data){
|
$.each(this.frm.doc['payments'] || [], function(index, data){
|
||||||
if(data.type == "Cash" && payment_status) {
|
if(data.type == "Cash" && payment_status) {
|
||||||
data.amount = total_amount_to_pay;
|
data.amount = total_amount_to_pay;
|
||||||
|
@ -57,6 +57,13 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
|||||||
currency: me.frm.doc.currency,
|
currency: me.frm.doc.currency,
|
||||||
type: data.type
|
type: data.type
|
||||||
})).appendTo(multimode_payments)
|
})).appendTo(multimode_payments)
|
||||||
|
|
||||||
|
if (data.type == 'Cash' && data.amount == me.frm.doc.paid_amount) {
|
||||||
|
me.idx = data.idx;
|
||||||
|
me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
|
||||||
|
me.highlight_selected_row();
|
||||||
|
me.bind_amount_change_event();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
|
$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
|
||||||
@ -90,8 +97,10 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
|||||||
bind_payment_mode_keys_event: function(){
|
bind_payment_mode_keys_event: function(){
|
||||||
var me = this;
|
var me = this;
|
||||||
$(this.$body).find('.pos-payment-row').click(function(){
|
$(this.$body).find('.pos-payment-row').click(function(){
|
||||||
|
if(me.frm.doc.outstanding_amount > 0){
|
||||||
me.idx = $(this).attr("idx");
|
me.idx = $(this).attr("idx");
|
||||||
me.set_outstanding_amount()
|
me.set_outstanding_amount()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -124,12 +133,16 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
bind_amount_change_event: function(){
|
bind_amount_change_event: function(){
|
||||||
var me = this;
|
var me = this;
|
||||||
me.selected_mode.change(function(){
|
this.selected_mode.change(function(){
|
||||||
me.payment_val = flt($(this).val()) || 0.0;
|
me.payment_val = flt($(this).val()) || 0.0;
|
||||||
me.selected_mode.val(format_number(me.payment_val, 2))
|
me.selected_mode.val(format_number(me.payment_val, 2))
|
||||||
me.idx = me.selected_mode.attr("idx")
|
me.idx = me.selected_mode.attr("idx")
|
||||||
me.update_paid_amount()
|
me.update_paid_amount()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.selected_mode.click(function(){
|
||||||
|
me.selected_mode.select();
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
clear_amount: function(){
|
clear_amount: function(){
|
||||||
@ -140,6 +153,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
|||||||
me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
|
me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
|
||||||
me.payment_val = 0.0;
|
me.payment_val = 0.0;
|
||||||
me.selected_mode.val(0.0);
|
me.selected_mode.val(0.0);
|
||||||
|
me.highlight_selected_row();
|
||||||
me.update_paid_amount();
|
me.update_paid_amount();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user