Merge pull request #25582 from deepeshgarg007/this_variable

fix: function call to update payment schedule labels
This commit is contained in:
Deepesh Garg 2021-05-06 15:50:47 +05:30 committed by GitHub
commit 8a1f86db16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1379,12 +1379,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
update_payment_schedule_grid_labels: function(company_currency) { update_payment_schedule_grid_labels: function(company_currency) {
const me = this; const me = this;
if (this.frm.fields_dict["payment_schedule"]) { if (this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length > 0) {
this.frm.set_currency_labels(["base_payment_amount", "base_outstanding", "base_paid_amount"], this.frm.set_currency_labels(["base_payment_amount", "base_outstanding", "base_paid_amount"],
company_currency, "payment_schedule"); company_currency, "payment_schedule");
this.frm.set_currency_labels(["payment_amount", "outstanding", "paid_amount"], this.frm.set_currency_labels(["payment_amount", "outstanding", "paid_amount"],
this.frm.doc.currency, "payment_schedule"); this.frm.doc.currency, "payment_schedule");
var schedule_grid = this.frm.fields_dict["payment_schedule"].grid; var schedule_grid = this.frm.fields_dict["payment_schedule"].grid;
$.each(["base_payment_amount", "base_outstanding", "base_paid_amount"], function(i, fname) { $.each(["base_payment_amount", "base_outstanding", "base_paid_amount"], function(i, fname) {
if (frappe.meta.get_docfield(schedule_grid.doctype, fname)) if (frappe.meta.get_docfield(schedule_grid.doctype, fname))
@ -2034,7 +2034,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if(r.message && !r.exc) { if(r.message && !r.exc) {
me.frm.set_value("payment_schedule", r.message); me.frm.set_value("payment_schedule", r.message);
const company_currency = me.get_company_currency(); const company_currency = me.get_company_currency();
this.update_payment_schedule_grid_labels(company_currency); me.update_payment_schedule_grid_labels(company_currency);
} }
} }
}) })