chore: resolve undefined variables issue

This commit is contained in:
Deepesh Garg 2023-07-22 23:07:18 +05:30
parent 0b1e78e127
commit 4077254b01
11 changed files with 17 additions and 21 deletions

View File

@ -29,7 +29,8 @@ repos:
cypress/.*| cypress/.*|
.*node_modules.*| .*node_modules.*|
.*boilerplate.*| .*boilerplate.*|
erpnext/public/js/controllers/.* erpnext/public/js/controllers/.*|
erpnext/templates/pages/order.js
)$ )$
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8

View File

@ -70,7 +70,7 @@ frappe.ui.form.on('Cost Center', {
} }
], ],
primary_action: function() { 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) { if(data.cost_center_name === frm.doc.cost_center_name && data.cost_center_number === frm.doc.cost_center_number) {
d.hide(); d.hide();
return; return;
@ -91,8 +91,8 @@ frappe.ui.form.on('Cost Center', {
if(r.message) { if(r.message) {
frappe.set_route("Form", "Cost Center", r.message); frappe.set_route("Form", "Cost Center", r.message);
} else { } else {
me.frm.set_value("cost_center_name", data.cost_center_name); 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_number", data.cost_center_number);
} }
d.hide(); d.hide();
} }

View File

@ -14,7 +14,7 @@ frappe.ui.form.on('Payment Term', {
if (frm.doc.discount) { if (frm.doc.discount) {
let description = __("{0}% of total invoice value will be given as discount.", [frm.doc.discount]); let description = __("{0}% of total invoice value will be given as discount.", [frm.doc.discount]);
if (frm.doc.discount_type == 'Amount') { 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); frm.set_df_property("discount", "description", description);
} }

View File

@ -1,8 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* global frappe, refresh_field */
frappe.ui.form.on("Supplier Scorecard", { frappe.ui.form.on("Supplier Scorecard", {
setup: function(frm) { setup: function(frm) {
if (frm.doc.indicator_color !== "") { if (frm.doc.indicator_color !== "") {
@ -79,7 +77,7 @@ var loadAllStandings = function(frm) {
callback: function(r) { callback: function(r) {
for (var j = 0; j < frm.doc.standings.length; j++) 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(); frm.get_field("standings").grid.grid_rows[j].remove();
} }
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* global frappe, __ */
frappe.listview_settings["Supplier Scorecard"] = { frappe.listview_settings["Supplier Scorecard"] = {
add_fields: ["indicator_color", "status"], add_fields: ["indicator_color", "status"],
@ -14,4 +13,4 @@ frappe.listview_settings["Supplier Scorecard"] = {
} }
}, },
}; }

View File

@ -1,8 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* global frappe */
frappe.ui.form.on("Supplier Scorecard Criteria", { frappe.ui.form.on("Supplier Scorecard Criteria", {
refresh: function() {} refresh: function() {}
}); });

View File

@ -208,7 +208,7 @@ erpnext.accounts.taxes = {
erpnext.accounts.payment_triggers = { erpnext.accounts.payment_triggers = {
setup: function(doctype) { setup: function(doctype) {
frappe.form.ui.on(doctype, { frappe.ui.form.on(doctype, {
allocate_advances_automatically(frm) { allocate_advances_automatically(frm) {
frm.trigger('fetch_advances'); frm.trigger('fetch_advances');
}, },

View File

@ -637,7 +637,7 @@ erpnext.utils.update_child_items = function(opts) {
}) })
} }
new frappe.ui.Dialog({ let dialog = new frappe.ui.Dialog({
title: __("Update Items"), title: __("Update Items"),
size: "extra-large", size: "extra-large",
fields: [ fields: [
@ -674,7 +674,9 @@ erpnext.utils.update_child_items = function(opts) {
refresh_field("items"); refresh_field("items");
}, },
primary_action_label: __('Update') primary_action_label: __('Update')
}).show(); })
dialog.show();
} }
erpnext.utils.map_current_doc = function(opts) { erpnext.utils.map_current_doc = function(opts) {

View File

@ -382,7 +382,7 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate {
edit_full_form() { edit_full_form() {
let bundle_id = this.item.serial_and_batch_bundle let bundle_id = this.item.serial_and_batch_bundle
if (!bundle_id) { if (!bundle_id) {
_new = frappe.model.get_new_doc( let _new = frappe.model.get_new_doc(
"Serial and Batch Bundle", null, null, true "Serial and Batch Bundle", null, null, true
); );

View File

@ -129,8 +129,6 @@ erpnext.stock.ItemDashboard = class ItemDashboard {
context = this.get_item_dashboard_data(data, this.max_count, true); context = this.get_item_dashboard_data(data, this.max_count, true);
} }
this.max_count = this.max_count;
// show more button // show more button
if (data && data.length === (this.page_length + 1)) { if (data && data.length === (this.page_length + 1)) {
this.content.find('.more').removeClass('hidden'); this.content.find('.more').removeClass('hidden');

View File

@ -24,7 +24,7 @@ frappe.listview_settings['Delivery Note'] = {
if (!doc.docstatus) { if (!doc.docstatus) {
frappe.throw(__("Cannot create a Delivery Trip from Draft documents.")); frappe.throw(__("Cannot create a Delivery Trip from Draft documents."));
} }
}; }
frappe.new_doc("Delivery Trip") frappe.new_doc("Delivery Trip")
.then(() => { .then(() => {
@ -51,7 +51,7 @@ frappe.listview_settings['Delivery Note'] = {
} }
}); });
}) })
}; }
}; };
// doclist.page.add_actions_menu_item(__('Create Delivery Trip'), action, false); // 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"); erpnext.bulk_transaction_processing.create(doclist, "Delivery Note", "Packing Slip");
}); });
} }
}; }