I been trying to hack the current POS so as to be able to select the appropriate batch than just give error
Here is what I did. I replaced the frappe.throw in mandatiry_batch_no() with a frappe.prompt displaying a selection box with the possible batch nos. The prompt box appears, but the item gets added even before I select the batch. When I was expecting the flow to pause wait for my input and proceed. What is it that I am doing wrong?
mandatory_batch_no: function () {
var me = this;
if (this.items[0].has_batch_no && !this.item_batch_no[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'
)
}}