Prompt for mandatory batch number in POS (#8928)
* Prompt for mandatory batch number in POS * Whitespaces correction
This commit is contained in:
parent
56549fd3d9
commit
8bec0239b9
@ -392,7 +392,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.make_item_list();
|
this.make_item_list();
|
||||||
this.make_discount_field()
|
this.make_discount_field()
|
||||||
},
|
},
|
||||||
|
|
||||||
make_control: function() {
|
make_control: function() {
|
||||||
this.frm = {}
|
this.frm = {}
|
||||||
this.frm.doc = this.doc
|
this.frm.doc = this.doc
|
||||||
@ -537,7 +537,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
me.toggle_totals_area();
|
me.toggle_totals_area();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
bind_numeric_keypad: function() {
|
bind_numeric_keypad: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
$(this.numeric_keypad).find('.pos-operation').on('click', function(){
|
$(this.numeric_keypad).find('.pos-operation').on('click', function(){
|
||||||
@ -566,7 +566,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
me.selected_field.closest('.pos-list-row').addClass('active');
|
me.selected_field.closest('.pos-list-row').addClass('active');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$(this.numeric_keypad).find('.numeric-del').click(function(){
|
$(this.numeric_keypad).find('.numeric-del').click(function(){
|
||||||
me.selected_field = $(me.wrapper).find('.selected-item').find('.' + me.numeric_id)
|
me.selected_field = $(me.wrapper).find('.selected-item').find('.' + me.numeric_id)
|
||||||
me.numeric_val = cstr(flt(me.selected_field.val())).slice(0, -1);
|
me.numeric_val = cstr(flt(me.selected_field.val())).slice(0, -1);
|
||||||
@ -574,7 +574,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
me.selected_field.trigger("change")
|
me.selected_field.trigger("change")
|
||||||
// me.render_selected_item()
|
// me.render_selected_item()
|
||||||
})
|
})
|
||||||
|
|
||||||
$(this.numeric_keypad).find('.pos-pay').click(function(){
|
$(this.numeric_keypad).find('.pos-pay').click(function(){
|
||||||
me.validate();
|
me.validate();
|
||||||
me.update_paid_amount_status(true);
|
me.update_paid_amount_status(true);
|
||||||
@ -982,7 +982,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
})).tooltip().appendTo($wrap);
|
})).tooltip().appendTo($wrap);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$wrap.append(`
|
$wrap.append(`
|
||||||
<div class="image-view-item btn-more text-muted text-center">
|
<div class="image-view-item btn-more text-muted text-center">
|
||||||
<div class="image-view-body">
|
<div class="image-view-body">
|
||||||
@ -1064,7 +1064,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
bind_items_event: function() {
|
bind_items_event: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
$(this.wrapper).on('click', '.pos-bill-item', function() {
|
$(this.wrapper).on('click', '.pos-bill-item', function() {
|
||||||
@ -1101,7 +1101,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
|
var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
|
||||||
me.update_qty(item_code, qty)
|
me.update_qty(item_code, qty)
|
||||||
})
|
})
|
||||||
|
|
||||||
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
||||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||||
var discount = $(this).val();
|
var discount = $(this).val();
|
||||||
@ -1757,10 +1757,14 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
mandatory_batch_no: function () {
|
mandatory_batch_no: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
|
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
|
||||||
frappe.throw(__(repl("Error: Batch no is mandatory for item %(item)s", {
|
frappe.prompt([
|
||||||
'item': this.items[0].item_code
|
{'fieldname': 'batch', 'fieldtype': 'Select', 'label': __('Batch No'), 'reqd': 1, 'options':this.batch_no_data[this.items[0].item_code]}
|
||||||
})))
|
],
|
||||||
}
|
function(values){
|
||||||
|
me.item_batch_no[me.items[0].item_code] = values.batch;
|
||||||
|
},
|
||||||
|
__('Select Batch No'))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
apply_pricing_rule: function () {
|
apply_pricing_rule: function () {
|
||||||
@ -1782,7 +1786,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
item.pricing_rule = null;
|
item.pricing_rule = null;
|
||||||
me.apply_pricing_rule_on_item(item)
|
me.apply_pricing_rule_on_item(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item.discount_percentage > 0) {
|
if(item.discount_percentage > 0) {
|
||||||
me.apply_pricing_rule_on_item(item)
|
me.apply_pricing_rule_on_item(item)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user