Hi
POS functions keyboard_keydown_handler() and keyboard_handler() blocks typing of content using your keyboard with the pop-up window. To fix this ;
Create your pos_custom.js file and override the functions from the PaymentScreenWidget. See below code
odoo.define('pos_custom', function (require) {
"use strict";
//
var core = require('web.core');
var utils = require('web.utils');
//
var module = require('point_of_sale.models'); //Includes all Base Classes of point of sale
var round_di = utils.round_decimals;
var round_pr = utils.round_precision;
//Screens
var screens = require('point_of_sale.screens') // Require Base screens class
//
var QWeb = core.qweb;
var _t = core._t;
//
//Extend payment screen and add more functionality screens.PaymentScreenWidget.include({
click_paymentmethods: function(id) {
var self = this ;
var cashregister = null;
for ( var i = 0; i < this.pos.cashregisters.length; i++ ) {
if ( this.pos.cashregisters[i].journal_id[0] === id ){
cashregister = this.pos.cashregisters[i];
break;
}
}
//debug
console.log("Payment Register ID >> " +cashregister.journal.id) ;
console.log("Payment Register Type >>> "+cashregister.journal.payment_mode) ;
//
if(cashregister.journal.payment_mode === 'mpesa'){
var phone_no = '123456' ;
// alert("Enter Client Phone Number >> ") ;
self.gui.show_popup('textinput',{
title: _t("Enter Client Phone Number") ,
confirm: function(){
//get value
var value = this.$('#text-input').val();
//alert(value);
//console.log("Value Captured ",value);
if(value){
console.log("Perform Validation of MPESA Code") ;
//Add Payment Line after success validation of the code
self.pos.get_order().add_paymentline( cashregister );
self.reset_input();
self.render_paymentlines();
}else{
// console.log("Cannot validate Code..");
self.gui.show_popup('error',{
'title': _t('Error: Payment Validation Error'),
'body': _t('Sorry Cannot validate the payment. Try again later'),
});
}
},
}) ;
}else {
//Add Payment Line after success validation of the code
self.pos.get_order().add_paymentline( cashregister );
self.reset_input();
self.render_paymentlines();
}
},
init: function(parent, options) {
var self = this;
this._super(parent, options);
//Overide methods
this.keyboard_keydown_handler = function(event){
if (event.keyCode === 8 || event.keyCode === 46) { // Backspace and Delete
event.preventDefault();
self.keyboard_handler(event);
}
};
this.keyboard_handler = function(event){
var key = '';
if (event.type === "keypress") {
if (event.keyCode === 13) { // Enter
self.validate_order();
} else if ( event.keyCode === 190 || // Dot
event.keyCode === 110 || // Decimal point (numpad)
event.keyCode === 188 || // Comma
event.keyCode === 46 ) { // Numpad dot
key = self.decimal_point;
} else if (event.keyCode >= 48 && event.keyCode <= 57) { // Numbers
key = '' + (event.keyCode - 48);
} else if (event.keyCode === 45) { // Minus
key = '-';
} else if (event.keyCode === 43) { // Plus
key = '+';
}else{
return ;
}
} else { // keyup/keydown
if (event.keyCode === 46) { // Delete
key = 'CLEAR';
} else if (event.keyCode === 8) { // Backspace
key = 'BACKSPACE';
}
}
self.payment_input(key);
// event.preventDefault();
/* if (event.type === "keypress") {
return ;
}*/
};
//End method override
} ,
}) ;
});
Thanks..