Prompt for mandatory batch number in POS (#8928)

* Prompt for mandatory batch number in POS

* Whitespaces correction
This commit is contained in:
Charles-Henri Decultot 2017-05-19 12:32:30 +02:00 committed by Nabin Hait
parent c320537e4c
commit ce9ac7885e

View File

@ -398,7 +398,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.make_item_list();
this.make_discount_field()
},
make_control: function() {
this.frm = {}
this.frm.doc = this.doc
@ -543,7 +543,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.toggle_totals_area();
});
},
bind_numeric_keypad: function() {
var me = this;
$(this.numeric_keypad).find('.pos-operation').on('click', function(){
@ -572,7 +572,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.selected_field.closest('.pos-list-row').addClass('active');
}
})
$(this.numeric_keypad).find('.numeric-del').click(function(){
me.selected_field = $(me.wrapper).find('.selected-item').find('.' + me.numeric_id)
me.numeric_val = cstr(flt(me.selected_field.val())).slice(0, -1);
@ -580,7 +580,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.selected_field.trigger("change")
// me.render_selected_item()
})
$(this.numeric_keypad).find('.pos-pay').click(function(){
me.validate();
me.update_paid_amount_status(true);
@ -988,7 +988,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
})).tooltip().appendTo($wrap);
}
});
$wrap.append(`
<div class="image-view-item btn-more text-muted text-center">
<div class="image-view-body">
@ -1070,7 +1070,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
});
}
},
bind_items_event: function() {
var me = this;
$(this.wrapper).on('click', '.pos-bill-item', function() {
@ -1107,7 +1107,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
me.update_qty(item_code, qty)
})
$(this.wrapper).on("change", ".pos-item-disc", function () {
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
var discount = $(this).val();
@ -1763,10 +1763,14 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
mandatory_batch_no: function () {
var me = this;
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", {
'item': this.items[0].item_code
})))
}
frappe.prompt([
{'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 () {
@ -1788,7 +1792,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
item.pricing_rule = null;
me.apply_pricing_rule_on_item(item)
}
if(item.discount_percentage > 0) {
me.apply_pricing_rule_on_item(item)
}