diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93d07485e6..b01b56a856 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,8 @@ repos: 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 632fab0197..c427cc8b87 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.js +++ b/erpnext/accounts/doctype/cost_center/cost_center.js @@ -70,7 +70,7 @@ frappe.ui.form.on('Cost Center', { } ], 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 @@ frappe.ui.form.on('Cost Center', { 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 feecf93484..0898a09a1c 100644 --- a/erpnext/accounts/doctype/payment_term/payment_term.js +++ b/erpnext/accounts/doctype/payment_term/payment_term.js @@ -14,7 +14,7 @@ frappe.ui.form.on('Payment Term', { 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 b4cd852c32..e9d56784ff 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 @@ var loadAllStandings = function(frm) { 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 dc5474e3b4..edf0b04d72 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 @@ frappe.listview_settings["Supplier Scorecard"] = { } }, -}; +} 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 9f8a2dee81..2186cd89eb 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 d03a07cf03..a2e4bdacac 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -208,7 +208,7 @@ erpnext.accounts.taxes = { 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 8633be8c42..09109f7a5e 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -637,7 +637,7 @@ erpnext.utils.update_child_items = function(opts) { }) } - new frappe.ui.Dialog({ + let dialog = new frappe.ui.Dialog({ title: __("Update Items"), size: "extra-large", fields: [ @@ -674,7 +674,9 @@ erpnext.utils.update_child_items = function(opts) { 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 27a7968033..9267801839 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 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { 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 b09b715275..e02abb48e5 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -129,8 +129,6 @@ erpnext.stock.ItemDashboard = class ItemDashboard { 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 6ff3ed3e8e..51a899b699 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 @@ frappe.listview_settings['Delivery Note'] = { if (!doc.docstatus) { frappe.throw(__("Cannot create a Delivery Trip from Draft documents.")); } - }; + } frappe.new_doc("Delivery Trip") .then(() => { @@ -51,7 +51,7 @@ frappe.listview_settings['Delivery Note'] = { } }); }) - }; + } }; // doclist.page.add_actions_menu_item(__('Create Delivery Trip'), action, false); @@ -66,4 +66,4 @@ frappe.listview_settings['Delivery Note'] = { erpnext.bulk_transaction_processing.create(doclist, "Delivery Note", "Packing Slip"); }); } -}; +}