I have this cash control pop up. I wanted to click on the table row then insert the value from the number pad. Is there any way I can do that?
I'm putting this script
directly in xml
. Currently, I need to click the number pad before clicking on the row. Is there any way I can modify it to allow the desire behavior?
if (document.querySelectorAll("input.o_input.o_field_integer")[0] ){
if (document.getElementsByClassName('use-keyboard-input')[0]){
document.querySelectorAll("input.o_input.o_field_integer")[0].value = document.getElementsByClassName('use-keyboard-input')[0].value;
document.querySelectorAll("input.o_input.o_field_integer")[0].dispatchEvent(new Event('change', { 'bubbles': true }));
}
}
}, 500)
document.getElementById('cash-control-backspace').onclick = function(event){
document.getElementsByClassName('use-keyboard-input')[0].value = document.getElementsByClassName('use-keyboard-input')[0].value.slice(0, -1);
}
document.getElementById('cash-control-C').onclick = function(event){
document.getElementsByClassName('use-keyboard-input')[0].value = '';
}
function returnVal(numStr){
document.getElementById('cash-control-'+numStr).onclick = function(event){
document.getElementsByClassName('use-keyboard-input')[0].value = document.getElementsByClassName('use-keyboard-input')[0].value + numStr;
}
}
returnVal('1')
returnVal('2')
returnVal('3')
returnVal('4')
returnVal('5')
returnVal('6')
returnVal('7')
returnVal('8')
returnVal('9')
returnVal('0')
Any other solution using backbone.js
/ jquery
/ vanilla js
is welcome
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…