Skip to content

Commit

Permalink
fix: pos payment mode selection issue (frappe#27409)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesis189 authored and nextchamp-saqib committed Sep 9, 2021
1 parent 40fa4cf commit f6d95f5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions erpnext/selling/page/point_of_sale/pos_payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ erpnext.PointOfSale.Payment = class {
this.render_payment_mode_dom();
this.make_invoice_fields_control();
this.update_totals_section();
this.focus_on_default_mop();
}

edit_cart() {
Expand Down Expand Up @@ -378,17 +379,24 @@ erpnext.PointOfSale.Payment = class {
});
this[`${mode}_control`].toggle_label(false);
this[`${mode}_control`].set_value(p.amount);
});

this.render_loyalty_points_payment_mode();

this.attach_cash_shortcuts(doc);
}

focus_on_default_mop() {
const doc = this.events.get_frm().doc;
const payments = doc.payments;
payments.forEach(p => {
const mode = p.mode_of_payment.replace(/ +/g, "_").toLowerCase();
if (p.default) {
setTimeout(() => {
this.$payment_modes.find(`.${mode}.mode-of-payment-control`).parent().click();
}, 500);
}
});

this.render_loyalty_points_payment_mode();

this.attach_cash_shortcuts(doc);
}

attach_cash_shortcuts(doc) {
Expand Down

0 comments on commit f6d95f5

Please sign in to comment.