mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 19:35:09 +00:00
refactor(pos): set/reset grand total to default mode of payment
This commit is contained in:
@@ -450,10 +450,11 @@ erpnext.PointOfSale.Payment = class {
|
||||
}
|
||||
|
||||
render_payment_section() {
|
||||
this.grand_total_to_default_mop();
|
||||
this.render_payment_mode_dom();
|
||||
this.make_invoice_field_dialog();
|
||||
this.update_totals_section();
|
||||
this.set_grand_total_to_default_mop();
|
||||
this.focus_on_default_mop();
|
||||
}
|
||||
|
||||
after_render() {
|
||||
@@ -497,6 +498,17 @@ erpnext.PointOfSale.Payment = class {
|
||||
}
|
||||
}
|
||||
|
||||
grand_total_to_default_mop() {
|
||||
if (this.set_gt_to_default_mop) return;
|
||||
const doc = this.events.get_frm().doc;
|
||||
const payments = doc.payments;
|
||||
payments.forEach((p) => {
|
||||
if (p.default) {
|
||||
frappe.model.set_value(p.doctype, p.name, "amount", 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render_payment_mode_dom() {
|
||||
const doc = this.events.get_frm().doc;
|
||||
const payments = doc.payments;
|
||||
@@ -557,6 +569,7 @@ erpnext.PointOfSale.Payment = class {
|
||||
}
|
||||
|
||||
focus_on_default_mop() {
|
||||
if (!this.set_gt_to_default_mop) return;
|
||||
const doc = this.events.get_frm().doc;
|
||||
const payments = doc.payments;
|
||||
payments.forEach((p) => {
|
||||
@@ -711,12 +724,6 @@ erpnext.PointOfSale.Payment = class {
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
set_grand_total_to_default_mop() {
|
||||
if (this.set_gt_to_default_mop) {
|
||||
this.focus_on_default_mop();
|
||||
}
|
||||
}
|
||||
|
||||
validate_reqd_invoice_fields() {
|
||||
if (this.invoice_fields.length === 0) return true;
|
||||
const doc = this.events.get_frm().doc;
|
||||
|
||||
Reference in New Issue
Block a user