mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-30 02:14:48 +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() {
|
render_payment_section() {
|
||||||
|
this.grand_total_to_default_mop();
|
||||||
this.render_payment_mode_dom();
|
this.render_payment_mode_dom();
|
||||||
this.make_invoice_field_dialog();
|
this.make_invoice_field_dialog();
|
||||||
this.update_totals_section();
|
this.update_totals_section();
|
||||||
this.set_grand_total_to_default_mop();
|
this.focus_on_default_mop();
|
||||||
}
|
}
|
||||||
|
|
||||||
after_render() {
|
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() {
|
render_payment_mode_dom() {
|
||||||
const doc = this.events.get_frm().doc;
|
const doc = this.events.get_frm().doc;
|
||||||
const payments = doc.payments;
|
const payments = doc.payments;
|
||||||
@@ -557,6 +569,7 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
focus_on_default_mop() {
|
focus_on_default_mop() {
|
||||||
|
if (!this.set_gt_to_default_mop) return;
|
||||||
const doc = this.events.get_frm().doc;
|
const doc = this.events.get_frm().doc;
|
||||||
const payments = doc.payments;
|
const payments = doc.payments;
|
||||||
payments.forEach((p) => {
|
payments.forEach((p) => {
|
||||||
@@ -711,12 +724,6 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
set_grand_total_to_default_mop() {
|
|
||||||
if (this.set_gt_to_default_mop) {
|
|
||||||
this.focus_on_default_mop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_reqd_invoice_fields() {
|
validate_reqd_invoice_fields() {
|
||||||
if (this.invoice_fields.length === 0) return true;
|
if (this.invoice_fields.length === 0) return true;
|
||||||
const doc = this.events.get_frm().doc;
|
const doc = this.events.get_frm().doc;
|
||||||
|
|||||||
Reference in New Issue
Block a user