refactor: usage of in_list
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 8135bb2..e6fa055 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -315,7 +315,7 @@
}
setup_quality_inspection() {
- if(!in_list(["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"], this.frm.doc.doctype)) {
+ if(!["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(this.frm.doc.doctype)) {
return;
}
@@ -327,7 +327,7 @@
this.frm.page.set_inner_btn_group_as_primary(__('Create'));
}
- const inspection_type = in_list(["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"], this.frm.doc.doctype)
+ const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(this.frm.doc.doctype)
? "Incoming" : "Outgoing";
let quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
@@ -359,7 +359,7 @@
make_payment_request() {
let me = this;
- const payment_request_type = (in_list(['Sales Order', 'Sales Invoice'], this.frm.doc.doctype))
+ const payment_request_type = (['Sales Order', 'Sales Invoice'].includes(this.frm.doc.doctype))
? "Inward" : "Outward";
frappe.call({
@@ -474,7 +474,7 @@
setup_sms() {
var me = this;
let blacklist = ['Purchase Invoice', 'BOM'];
- if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status)
+ if(this.frm.doc.docstatus===1 && !["Lost", "Stopped", "Closed"].includes(this.frm.doc.status)
&& !blacklist.includes(this.frm.doctype)) {
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
}
@@ -760,7 +760,7 @@
}
on_submit() {
- if (in_list(["Purchase Invoice", "Sales Invoice"], this.frm.doc.doctype)
+ if (["Purchase Invoice", "Sales Invoice"].includes(this.frm.doc.doctype)
&& !this.frm.doc.update_stock) {
return;
}
@@ -864,7 +864,7 @@
}
var set_party_account = function(set_pricing) {
- if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) {
+ if (["Sales Invoice", "Purchase Invoice"].includes(me.frm.doc.doctype)) {
if(me.frm.doc.doctype=="Sales Invoice") {
var party_type = "Customer";
var party_account_field = 'debit_to';
@@ -899,7 +899,7 @@
}
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
- in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)) {
+ ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'].includes(this.frm.doctype)) {
erpnext.utils.get_shipping_address(this.frm, function() {
set_party_account(set_pricing);
});
@@ -1620,7 +1620,7 @@
"doctype": me.frm.doc.doctype,
"name": me.frm.doc.name,
"is_return": cint(me.frm.doc.is_return),
- "update_stock": in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
+ "update_stock": ['Sales Invoice', 'Purchase Invoice'].includes(me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
"conversion_factor": me.frm.doc.conversion_factor,
"pos_profile": me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '',
"coupon_code": me.frm.doc.coupon_code
@@ -2266,7 +2266,7 @@
get_method_for_payment() {
var method = "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry";
if(cur_frm.doc.__onload && cur_frm.doc.__onload.make_payment_via_journal_entry){
- if(in_list(['Sales Invoice', 'Purchase Invoice'], cur_frm.doc.doctype)){
+ if(['Sales Invoice', 'Purchase Invoice'].includes( cur_frm.doc.doctype)){
method = "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_invoice";
}else {
method= "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_order";
@@ -2506,7 +2506,7 @@
}
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
- if (in_list(["Sales Invoice", "Delivery Note"], frm.doc.doctype)) {
+ if (["Sales Invoice", "Delivery Note"].includes(frm.doc.doctype)) {
item_row.type_of_transaction = frm.doc.is_return ? "Inward" : "Outward";
} else {
item_row.type_of_transaction = frm.doc.is_return ? "Outward" : "Inward";