chore: resolve undefined variables issue
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 93d0748..b01b56a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -29,7 +29,8 @@
cypress/.*|
.*node_modules.*|
.*boilerplate.*|
- erpnext/public/js/controllers/.*
+ erpnext/public/js/controllers/.*|
+ erpnext/templates/pages/order.js
)$
- repo: https://github.com/PyCQA/flake8
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index 632fab0..c427cc8 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -70,7 +70,7 @@
}
],
primary_action: function() {
- var data = d.get_values();
+ let data = d.get_values();
if(data.cost_center_name === frm.doc.cost_center_name && data.cost_center_number === frm.doc.cost_center_number) {
d.hide();
return;
@@ -91,8 +91,8 @@
if(r.message) {
frappe.set_route("Form", "Cost Center", r.message);
} else {
- me.frm.set_value("cost_center_name", data.cost_center_name);
- me.frm.set_value("cost_center_number", data.cost_center_number);
+ frm.set_value("cost_center_name", data.cost_center_name);
+ frm.set_value("cost_center_number", data.cost_center_number);
}
d.hide();
}
diff --git a/erpnext/accounts/doctype/payment_term/payment_term.js b/erpnext/accounts/doctype/payment_term/payment_term.js
index feecf93..0898a09 100644
--- a/erpnext/accounts/doctype/payment_term/payment_term.js
+++ b/erpnext/accounts/doctype/payment_term/payment_term.js
@@ -14,7 +14,7 @@
if (frm.doc.discount) {
let description = __("{0}% of total invoice value will be given as discount.", [frm.doc.discount]);
if (frm.doc.discount_type == 'Amount') {
- description = __("{0} will be given as discount.", [fmt_money(frm.doc.discount)]);
+ description = __("{0} will be given as discount.", [frm.doc.discount]);
}
frm.set_df_property("discount", "description", description);
}
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
index b4cd852..e9d5678 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.js
@@ -1,8 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-/* global frappe, refresh_field */
-
frappe.ui.form.on("Supplier Scorecard", {
setup: function(frm) {
if (frm.doc.indicator_color !== "") {
@@ -79,7 +77,7 @@
callback: function(r) {
for (var j = 0; j < frm.doc.standings.length; j++)
{
- if(!frm.doc.standings[j].hasOwnProperty("standing_name")) {
+ if(!Object.prototype.hasOwnProperty.call(frm.doc.standings[j], "standing_name")) {
frm.get_field("standings").grid.grid_rows[j].remove();
}
}
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_list.js b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_list.js
index dc5474e..edf0b04 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_list.js
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_list.js
@@ -1,7 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-/* global frappe, __ */
frappe.listview_settings["Supplier Scorecard"] = {
add_fields: ["indicator_color", "status"],
@@ -14,4 +13,4 @@
}
},
-};
+}
diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.js b/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.js
index 9f8a2de..2186cd8 100644
--- a/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.js
+++ b/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.js
@@ -1,8 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-/* global frappe */
-
frappe.ui.form.on("Supplier Scorecard Criteria", {
refresh: function() {}
});
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index d03a07c..a2e4bda 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -208,7 +208,7 @@
erpnext.accounts.payment_triggers = {
setup: function(doctype) {
- frappe.form.ui.on(doctype, {
+ frappe.ui.form.on(doctype, {
allocate_advances_automatically(frm) {
frm.trigger('fetch_advances');
},
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 8633be8..09109f7 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -637,7 +637,7 @@
})
}
- new frappe.ui.Dialog({
+ let dialog = new frappe.ui.Dialog({
title: __("Update Items"),
size: "extra-large",
fields: [
@@ -674,7 +674,9 @@
refresh_field("items");
},
primary_action_label: __('Update')
- }).show();
+ })
+
+ dialog.show();
}
erpnext.utils.map_current_doc = function(opts) {
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index 27a7968..9267801 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -382,7 +382,7 @@
edit_full_form() {
let bundle_id = this.item.serial_and_batch_bundle
if (!bundle_id) {
- _new = frappe.model.get_new_doc(
+ let _new = frappe.model.get_new_doc(
"Serial and Batch Bundle", null, null, true
);
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index b09b715..e02abb4 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -129,8 +129,6 @@
context = this.get_item_dashboard_data(data, this.max_count, true);
}
- this.max_count = this.max_count;
-
// show more button
if (data && data.length === (this.page_length + 1)) {
this.content.find('.more').removeClass('hidden');
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_list.js b/erpnext/stock/doctype/delivery_note/delivery_note_list.js
index 6ff3ed3..51a899b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_list.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_list.js
@@ -24,7 +24,7 @@
if (!doc.docstatus) {
frappe.throw(__("Cannot create a Delivery Trip from Draft documents."));
}
- };
+ }
frappe.new_doc("Delivery Trip")
.then(() => {
@@ -51,7 +51,7 @@
}
});
})
- };
+ }
};
// doclist.page.add_actions_menu_item(__('Create Delivery Trip'), action, false);
@@ -66,4 +66,4 @@
erpnext.bulk_transaction_processing.create(doclist, "Delivery Note", "Packing Slip");
});
}
-};
+}