fix: replacing $.each -> forEach in SI (#26995)

* fix: replacing $.each -> forEach in SI

* fix: removed console log

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
Anupam Kumar 2021-08-24 22:06:19 +05:30 committed by GitHub
parent 512ddc589f
commit 1d6ef4b0d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,9 +154,9 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
return
}
$.each(doc["items"], function(i, row) {
doc.items.forEach((row) => {
if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
})
});
}
set_default_print_format() {
@ -455,12 +455,15 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
}
currency() {
var me = this;
super.currency();
$.each(cur_frm.doc.timesheets, function(i, d) {
let row = frappe.get_doc(d.doctype, d.name)
set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail)
});
calculate_total_billing_amount(cur_frm)
if (this.frm.doc.timesheets) {
this.frm.doc.timesheets.forEach((d) => {
let row = frappe.get_doc(d.doctype, d.name)
set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail)
});
calculate_total_billing_amount(this.frm);
}
}
};
@ -983,9 +986,9 @@ var calculate_total_billing_amount = function(frm) {
doc.total_billing_amount = 0.0
if (doc.timesheets) {
$.each(doc.timesheets, function(index, data){
doc.total_billing_amount += flt(data.billing_amount)
})
doc.timesheets.forEach((d) => {
doc.total_billing_amount += flt(d.billing_amount)
});
}
refresh_field('total_billing_amount')