Skip to content

Commit

Permalink
Update pos_payment.js
Browse files Browse the repository at this point in the history
  • Loading branch information
bvisible authored Oct 30, 2023
1 parent b63b926 commit 4d5a6f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion erpnext/selling/page/point_of_sale/pos_payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,25 @@ erpnext.PointOfSale.Payment = class {
}

//// changes from v14 not applied. Maybe conflict
on_numpad_clicked($btn) {
async on_numpad_clicked($btn) { //// async added
const button_value = $btn.attr('data-button-value');
//// Wait for this.selected_mode to be defined
await new Promise(resolve => {
const intervalId = setInterval(() => {
if (this.selected_mode) {
clearInterval(intervalId);
resolve();
}
}, 100);
});
////

highlight_numpad_btn($btn);
this.numpad_value = button_value === 'delete' ? this.numpad_value.slice(0, -1) : this.numpad_value + button_value;
this.selected_mode.$input.get(0).focus();
if (this.selected_mode.$input) { //// added if condition
this.selected_mode.$input.get(0).focus();
} //// end if
this.selected_mode.set_value(this.numpad_value);

function highlight_numpad_btn($btn) {
Expand Down

0 comments on commit 4d5a6f8

Please sign in to comment.