From ca568a01f5deb1b434837092f4a321c58971f351 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 1 Jan 2026 21:56:12 +0530 Subject: [PATCH] fix: autofixes by semgrep --- erpnext/accounts/deferred_revenue.py | 14 +- .../accounts/doctype/account/test_account.py | 16 +- .../doctype/payment_entry/payment_entry.js | 6 +- .../payment_order/test_payment_order.py | 10 +- .../doctype/pricing_rule/pricing_rule.js | 2 +- .../test_process_deferred_accounting.py | 24 ++- .../promotional_scheme/promotional_scheme.js | 2 +- .../purchase_invoice/test_purchase_invoice.py | 14 +- .../sales_invoice/test_sales_invoice.py | 42 ++--- .../test_deferred_revenue_and_expense.py | 42 ++--- .../buying/doctype/supplier/test_supplier.py | 18 +- .../purchase_order_analysis.js | 2 +- .../v11_0/update_sales_partner_type.py | 2 +- .../v13_0/update_project_template_tasks.py | 16 +- erpnext/projects/doctype/project/project.py | 30 ++-- .../projects/doctype/project/test_project.py | 26 ++- .../project_template/test_project_template.py | 2 +- .../public/js/controllers/taxes_and_totals.js | 2 +- erpnext/public/js/controllers/transaction.js | 26 ++- erpnext/public/js/utils/barcode_scanner.js | 4 +- erpnext/public/js/utils/party.js | 8 +- .../quality_feedback/test_quality_feedback.py | 18 +- .../doctype/quality_goal/test_quality_goal.py | 10 +- erpnext/regional/address_template/setup.py | 2 +- erpnext/regional/italy/setup.py | 8 +- erpnext/regional/south_africa/setup.py | 8 +- .../regional/united_arab_emirates/setup.py | 8 +- .../selling/doctype/customer/test_customer.py | 36 ++-- .../doctype/sales_order/sales_order.py | 22 ++- .../doctype/sales_order/test_sales_order.py | 4 +- .../item_wise_sales_history.js | 2 +- .../sales_order_analysis.js | 2 +- erpnext/setup/doctype/company/company.js | 2 +- erpnext/stock/doctype/batch/batch.py | 30 ++-- erpnext/stock/doctype/batch/test_batch.py | 154 ++++++++---------- .../inventory_dimension.js | 2 +- erpnext/stock/doctype/item/item.js | 4 +- .../item_variant_settings.js | 4 +- .../stock/doctype/stock_entry/stock_entry.js | 9 +- .../stock_settings/test_stock_settings.py | 20 +-- erpnext/templates/utils.py | 14 +- 41 files changed, 294 insertions(+), 373 deletions(-) diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py index be723915951..c3e23fe6e50 100644 --- a/erpnext/accounts/deferred_revenue.py +++ b/erpnext/accounts/deferred_revenue.py @@ -450,14 +450,12 @@ def process_deferred_accounting(posting_date=None): for company in companies: for record_type in ("Income", "Expense"): doc = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - company=company.name, - posting_date=posting_date, - start_date=start_date, - end_date=end_date, - type=record_type, - ) + doctype="Process Deferred Accounting", + company=company.name, + posting_date=posting_date, + start_date=start_date, + end_date=end_date, + type=record_type, ) doc.insert() diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 795ee006806..6deff1ac3e6 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -415,15 +415,13 @@ def create_account(**kwargs): return account.name else: account = frappe.get_doc( - dict( - doctype="Account", - is_group=kwargs.get("is_group", 0), - account_name=kwargs.get("account_name"), - account_type=kwargs.get("account_type"), - parent_account=kwargs.get("parent_account"), - company=kwargs.get("company"), - account_currency=kwargs.get("account_currency"), - ) + doctype="Account", + is_group=kwargs.get("is_group", 0), + account_name=kwargs.get("account_name"), + account_type=kwargs.get("account_type"), + parent_account=kwargs.get("parent_account"), + company=kwargs.get("company"), + account_currency=kwargs.get("account_currency"), ) account.save() diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 4da7e2828e4..3020e4e6659 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -182,7 +182,7 @@ frappe.ui.form.on("Payment Entry", { "Dunning", ]; - if (in_list(party_type_doctypes, child.reference_doctype)) { + if (party_type_doctypes.includes(child.reference_doctype)) { filters[doc.party_type.toLowerCase()] = doc.party; } @@ -1041,7 +1041,7 @@ frappe.ui.form.on("Payment Entry", { c.allocated_amount = d.allocated_amount; c.account = d.account; - if (!in_list(frm.events.get_order_doctypes(frm), d.voucher_type)) { + if (!frm.events.get_order_doctypes(frm).includes(d.voucher_type)) { if (flt(d.outstanding_amount) > 0) total_positive_outstanding += flt(d.outstanding_amount); else total_negative_outstanding += Math.abs(flt(d.outstanding_amount)); @@ -1057,7 +1057,7 @@ frappe.ui.form.on("Payment Entry", { } else { c.exchange_rate = 1; } - if (in_list(frm.events.get_invoice_doctypes(frm), d.reference_doctype)) { + if (frm.events.get_invoice_doctypes(frm).includes(d.reference_doctype)) { c.due_date = d.due_date; } }); diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py index a261bc6b0b8..f12491fdf15 100644 --- a/erpnext/accounts/doctype/payment_order/test_payment_order.py +++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py @@ -50,12 +50,10 @@ class TestPaymentOrder(IntegrationTestCase): def create_payment_order_against_payment_entry(ref_doc, order_type, bank_account): payment_order = frappe.get_doc( - dict( - doctype="Payment Order", - company="_Test Company", - payment_order_type=order_type, - company_bank_account=bank_account, - ) + doctype="Payment Order", + company="_Test Company", + payment_order_type=order_type, + company_bank_account=bank_account, ) doc = make_payment_order(ref_doc.name, payment_order) doc.save() diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js index fda519e0851..7cce98f3323 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js @@ -171,7 +171,7 @@ frappe.ui.form.on("Pricing Rule", { set_field_options("applicable_for", options.join("\n")); - if (!in_list(options, applicable_for)) applicable_for = null; + if (!options.includes(applicable_for)) applicable_for = null; frm.set_value("applicable_for", applicable_for); }, }); diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index b987d1579e8..8d35b7fcf85 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -48,13 +48,11 @@ class TestProcessDeferredAccounting(IntegrationTestCase): check_gl_entries(self, si.name, original_gle, "2023-07-01") process_deferred_accounting = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date="2023-07-01", - start_date="2023-05-01", - end_date="2023-06-30", - type="Income", - ) + doctype="Process Deferred Accounting", + posting_date="2023-07-01", + start_date="2023-05-01", + end_date="2023-06-30", + type="Income", ) process_deferred_accounting.insert() @@ -80,13 +78,11 @@ class TestProcessDeferredAccounting(IntegrationTestCase): def test_pda_submission_and_cancellation(self): pda = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date="2019-01-01", - start_date="2019-01-01", - end_date="2019-01-31", - type="Income", - ) + doctype="Process Deferred Accounting", + posting_date="2019-01-01", + start_date="2019-01-01", + end_date="2019-01-31", + type="Income", ) pda.submit() pda.cancel() diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js index 43261e4080a..920b9a99eac 100644 --- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js +++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js @@ -46,7 +46,7 @@ frappe.ui.form.on("Promotional Scheme", { set_field_options("applicable_for", options.join("\n")); - if (!in_list(options, applicable_for)) applicable_for = null; + if (!options.includes(applicable_for)) applicable_for = null; frm.set_value("applicable_for", applicable_for); }, diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 9392a0e3220..adb11f8d615 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -1249,14 +1249,12 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin): pi.submit() pda1 = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2019-01-01", - end_date="2019-03-31", - type="Expense", - company="_Test Company", - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2019-01-01", + end_date="2019-03-31", + type="Expense", + company="_Test Company", ) pda1.insert() diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 1b98556f0c6..67dae79d083 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -2510,14 +2510,12 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() pda1 = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2019-01-01", - end_date="2019-03-31", - type="Income", - company="_Test Company", - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2019-01-01", + end_date="2019-03-31", + type="Income", + company="_Test Company", ) pda1.insert() @@ -2568,14 +2566,12 @@ class TestSalesInvoice(ERPNextTestSuite): si.submit() pda1 = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date="2019-03-31", - start_date="2019-01-01", - end_date="2019-03-31", - type="Income", - company="_Test Company", - ) + doctype="Process Deferred Accounting", + posting_date="2019-03-31", + start_date="2019-01-01", + end_date="2019-03-31", + type="Income", + company="_Test Company", ) pda1.insert() @@ -3478,14 +3474,12 @@ class TestSalesInvoice(ERPNextTestSuite): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", getdate("2019-01-31")) pda1 = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2019-01-01", - end_date="2019-03-31", - type="Income", - company="_Test Company", - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2019-01-01", + end_date="2019-03-31", + type="Income", + company="_Test Company", ) pda1.insert() diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py index d918a936091..fcd9075a30f 100644 --- a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py +++ b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py @@ -101,14 +101,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): si.submit() pda = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2021-05-01", - end_date="2021-08-01", - type="Income", - company=self.company, - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2021-05-01", + end_date="2021-08-01", + type="Income", + company=self.company, ) pda.insert() pda.submit() @@ -173,14 +171,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): pi.submit() pda = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2021-05-01", - end_date="2021-08-01", - type="Expense", - company=self.company, - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2021-05-01", + end_date="2021-08-01", + type="Expense", + company=self.company, ) pda.insert() pda.submit() @@ -240,14 +236,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin): si.submit() pda = frappe.get_doc( - dict( - doctype="Process Deferred Accounting", - posting_date=nowdate(), - start_date="2021-05-01", - end_date="2021-08-01", - type="Income", - company=self.company, - ) + doctype="Process Deferred Accounting", + posting_date=nowdate(), + start_date="2021-05-01", + end_date="2021-08-01", + type="Income", + company=self.company, ) pda.insert() pda.submit() diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index b6a8c7b288c..f3f0ede3e17 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -131,16 +131,14 @@ class TestSupplier(IntegrationTestCase): self.assertEqual(details.tax_category, "_Test Tax Category 1") address = frappe.get_doc( - dict( - doctype="Address", - address_title="_Test Address With Tax Category", - tax_category="_Test Tax Category 2", - address_type="Billing", - address_line1="Station Road", - city="_Test City", - country="India", - links=[dict(link_doctype="Supplier", link_name="_Test Supplier With Tax Category")], - ) + doctype="Address", + address_title="_Test Address With Tax Category", + tax_category="_Test Tax Category 2", + address_type="Billing", + address_line1="Station Road", + city="_Test City", + country="India", + links=[dict(link_doctype="Supplier", link_name="_Test Supplier With Tax Category")], ).insert() # Tax Category with Address diff --git a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.js b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.js index 2651023639e..90d9d6a0412 100644 --- a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.js +++ b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.js @@ -97,7 +97,7 @@ frappe.query_reports["Purchase Order Analysis"] = { value = default_formatter(value, row, column, data); let format_fields = ["received_qty", "billed_amount"]; - if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) { + if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) { value = "" + value + ""; } return value; diff --git a/erpnext/patches/v11_0/update_sales_partner_type.py b/erpnext/patches/v11_0/update_sales_partner_type.py index ced77d97276..75c28613a53 100644 --- a/erpnext/patches/v11_0/update_sales_partner_type.py +++ b/erpnext/patches/v11_0/update_sales_partner_type.py @@ -30,4 +30,4 @@ def execute(): def insert_sales_partner_type(s): if not frappe.db.exists("Sales Partner Type", s): - frappe.get_doc(dict(doctype="Sales Partner Type", sales_partner_type=s)).insert() + frappe.get_doc(doctype="Sales Partner Type", sales_partner_type=s).insert() diff --git a/erpnext/patches/v13_0/update_project_template_tasks.py b/erpnext/patches/v13_0/update_project_template_tasks.py index c9a23222424..4ba8f853a9e 100644 --- a/erpnext/patches/v13_0/update_project_template_tasks.py +++ b/erpnext/patches/v13_0/update_project_template_tasks.py @@ -30,15 +30,13 @@ def execute(): if task.subject: replace_tasks = True new_task = frappe.get_doc( - dict( - doctype="Task", - subject=task.subject, - start=task.start, - duration=task.duration, - task_weight=task.task_weight, - description=task.description, - is_template=1, - ) + doctype="Task", + subject=task.subject, + start=task.start, + duration=task.duration, + task_weight=task.task_weight, + description=task.description, + is_template=1, ).insert() new_tasks.append(new_task) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 13da8d10774..c7023dd9423 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -127,22 +127,20 @@ class Project(Document): def create_task_from_template(self, task_details): return frappe.get_doc( - dict( - doctype="Task", - subject=task_details.subject, - project=self.name, - status="Open", - exp_start_date=self.calculate_start_date(task_details), - exp_end_date=self.calculate_end_date(task_details), - description=task_details.description, - task_weight=task_details.task_weight, - type=task_details.type, - issue=task_details.issue, - is_group=task_details.is_group, - color=task_details.color, - template_task=task_details.name, - priority=task_details.priority, - ) + doctype="Task", + subject=task_details.subject, + project=self.name, + status="Open", + exp_start_date=self.calculate_start_date(task_details), + exp_end_date=self.calculate_end_date(task_details), + description=task_details.description, + task_weight=task_details.task_weight, + type=task_details.type, + issue=task_details.issue, + is_group=task_details.is_group, + color=task_details.color, + template_task=task_details.name, + priority=task_details.priority, ).insert() def calculate_start_date(self, task_details): diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index 5d353a3cdbd..2f1974ee4cb 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -255,14 +255,12 @@ class TestProject(ERPNextTestSuite): def get_project(name, template): project = frappe.get_doc( - dict( - doctype="Project", - project_name=name, - status="Open", - project_template=template.name, - expected_start_date=nowdate(), - company="_Test Company", - ) + doctype="Project", + project_name=name, + status="Open", + project_template=template.name, + expected_start_date=nowdate(), + company="_Test Company", ).insert() return project @@ -275,13 +273,11 @@ def make_project(args): return frappe.get_doc("Project", {"project_name": args.project_name}) project = frappe.get_doc( - dict( - doctype="Project", - project_name=args.project_name, - status="Open", - expected_start_date=args.start_date, - company=args.company or "_Test Company", - ) + doctype="Project", + project_name=args.project_name, + status="Open", + expected_start_date=args.start_date, + company=args.company or "_Test Company", ) if args.project_template_name: diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py index 7d94e5226ca..2671d7a02ec 100644 --- a/erpnext/projects/doctype/project_template/test_project_template.py +++ b/erpnext/projects/doctype/project_template/test_project_template.py @@ -20,7 +20,7 @@ def make_project_template(project_template_name, project_tasks=None): create_task(subject="_Test Template Task 1", is_template=1, begin=0, duration=3), create_task(subject="_Test Template Task 2", is_template=1, begin=0, duration=2), ] - doc = frappe.get_doc(dict(doctype="Project Template", name=project_template_name)) + doc = frappe.get_doc(doctype="Project Template", name=project_template_name) for task in project_tasks: doc.append("tasks", {"task": task.name}) doc.insert() diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 855dbfe67e9..87ec985ad18 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -1106,7 +1106,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { var payment_types = $.map(this.frm.doc.payments, function (d) { return d.type; }); - if (in_list(payment_types, "Cash")) { + if (payment_types.includes("Cash")) { var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total; var base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total; diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index fb782b12e0e..a77bd824f2f 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -904,7 +904,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe get_incoming_rate(item, posting_date, posting_time, voucher_type, company) { let item_args = { item_code: item.item_code, - warehouse: in_list("Purchase Receipt", "Purchase Invoice") ? item.from_warehouse : item.warehouse, + warehouse: item.warehouse, posting_date: posting_date, posting_time: posting_time, qty: item.qty * item.conversion_factor, @@ -2248,7 +2248,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe child.apply_rule_on_other_items && JSON.parse(child.apply_rule_on_other_items).length ) { - if (!in_list(JSON.parse(child.apply_rule_on_other_items), child.item_code)) { + if (!JSON.parse(child.apply_rule_on_other_items).includes(child.item_code)) { continue; } } @@ -2296,7 +2296,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe if (JSON.parse(data.apply_rule_on_other_items).includes(d[data.apply_rule_on])) { for (var k in data) { if ( - in_list(fields, k) && + fields.includes(k) && data[k] && (data.price_or_product_discount === "Price" || k === "pricing_rules") ) { @@ -2768,8 +2768,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } has_discount_in_schedule() { - let is_eligible = in_list( - ["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"], + let is_eligible = ["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"].includes( this.frm.doctype ); let has_payment_schedule = this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length; @@ -3205,16 +3204,13 @@ erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close } if ( - in_list( - [ - "Material Transfer", - "Send to Subcontractor", - "Material Issue", - "Material Consumption for Manufacture", - "Material Transfer for Manufacture", - ], - frm.doc.purpose - ) + [ + "Material Transfer", + "Send to Subcontractor", + "Material Issue", + "Material Consumption for Manufacture", + "Material Transfer for Manufacture", + ].includes(frm.doc.purpose) ) { warehouse_field = "s_warehouse"; } else { diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js index 822a9902a38..2e580f83c18 100644 --- a/erpnext/public/js/utils/barcode_scanner.js +++ b/erpnext/public/js/utils/barcode_scanner.js @@ -338,7 +338,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { ? this.dialog.get_value("serial_no").split("\n") : []; - if (in_list(serial_nos, serial_no)) { + if (serial_nos.includes(serial_no)) { frappe.throw(__("Serial No {0} already scanned", [serial_no])); } } @@ -359,7 +359,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { ]; for (let key in prev_row) { - if (in_list(ignore_fields, key)) { + if (ignore_fields.includes(key)) { continue; } diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index fcd6c05e4ac..d86296f1eea 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -36,14 +36,14 @@ erpnext.utils.get_party_details = function (frm, method, args, callback) { } if (!args) { - if (in_list(SALES_DOCTYPES, frm.doc.doctype)) { + if (SALES_DOCTYPES.includes(frm.doc.doctype)) { args = { party: frm.doc.customer || frm.doc.party_name, party_type: "Customer", }; } - if (in_list(PURCHASE_DOCTYPES, frm.doc.doctype)) { + if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) { args = { party: frm.doc.supplier, party_type: "Supplier", @@ -57,13 +57,13 @@ erpnext.utils.get_party_details = function (frm, method, args, callback) { args.fetch_payment_terms_template = cint(!frm.doc.ignore_default_payment_terms_template); } - if (in_list(SALES_DOCTYPES, frm.doc.doctype)) { + if (SALES_DOCTYPES.includes(frm.doc.doctype)) { if (!args.company_address && frm.doc.company_address) { args.company_address = frm.doc.company_address; } } - if (in_list(PURCHASE_DOCTYPES, frm.doc.doctype)) { + if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) { if (!args.company_address && frm.doc.billing_address) { args.company_address = frm.doc.billing_address; } diff --git a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py index 7baf908b3df..35a326ad943 100644 --- a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py +++ b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py @@ -9,20 +9,16 @@ from frappe.tests import IntegrationTestCase class TestQualityFeedback(IntegrationTestCase): def test_quality_feedback(self): template = frappe.get_doc( - dict( - doctype="Quality Feedback Template", - template="Test Template", - parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")], - ) + doctype="Quality Feedback Template", + template="Test Template", + parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")], ).insert() feedback = frappe.get_doc( - dict( - doctype="Quality Feedback", - template=template.name, - document_type="User", - document_name=frappe.session.user, - ) + doctype="Quality Feedback", + template=template.name, + document_type="User", + document_name=frappe.session.user, ).insert() self.assertEqual(template.parameters[0].parameter, feedback.parameters[0].parameter) diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py index 1b3727500b3..57d0a94ed0a 100644 --- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py +++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py @@ -16,10 +16,8 @@ class TestQualityGoal(IntegrationTestCase): def get_quality_goal(): return frappe.get_doc( - dict( - doctype="Quality Goal", - goal="Test Quality Module", - frequency="Daily", - objectives=[dict(objective="Check test cases", target="100", uom="Percent")], - ) + doctype="Quality Goal", + goal="Test Quality Module", + frequency="Daily", + objectives=[dict(objective="Check test cases", target="100", uom="Percent")], ).insert() diff --git a/erpnext/regional/address_template/setup.py b/erpnext/regional/address_template/setup.py index 684c76620a4..793767e0a90 100644 --- a/erpnext/regional/address_template/setup.py +++ b/erpnext/regional/address_template/setup.py @@ -50,5 +50,5 @@ def update_address_template(country, html, is_default=0): frappe.db.set_value("Address Template", country, "is_default", is_default) else: frappe.get_doc( - dict(doctype="Address Template", country=country, is_default=is_default, template=html) + doctype="Address Template", country=country, is_default=is_default, template=html ).insert() diff --git a/erpnext/regional/italy/setup.py b/erpnext/regional/italy/setup.py index b0296c948de..9f9115ca12d 100644 --- a/erpnext/regional/italy/setup.py +++ b/erpnext/regional/italy/setup.py @@ -470,11 +470,9 @@ def setup_report(): if not frappe.db.get_value("Custom Role", dict(report=report_name)): frappe.get_doc( - dict( - doctype="Custom Role", - report=report_name, - roles=[dict(role="Accounts User"), dict(role="Accounts Manager")], - ) + doctype="Custom Role", + report=report_name, + roles=[dict(role="Accounts User"), dict(role="Accounts Manager")], ).insert() diff --git a/erpnext/regional/south_africa/setup.py b/erpnext/regional/south_africa/setup.py index 289f2726e9b..3c9f492edfc 100644 --- a/erpnext/regional/south_africa/setup.py +++ b/erpnext/regional/south_africa/setup.py @@ -50,9 +50,7 @@ def add_permissions(): if not frappe.db.get_value("Custom Role", dict(report="VAT Audit Report")): frappe.get_doc( - dict( - doctype="Custom Role", - report="VAT Audit Report", - roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")], - ) + doctype="Custom Role", + report="VAT Audit Report", + roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")], ).insert() diff --git a/erpnext/regional/united_arab_emirates/setup.py b/erpnext/regional/united_arab_emirates/setup.py index 6a8c7b9438b..6541d5539e5 100644 --- a/erpnext/regional/united_arab_emirates/setup.py +++ b/erpnext/regional/united_arab_emirates/setup.py @@ -261,11 +261,9 @@ def add_custom_roles_for_reports(): """Add Access Control to UAE VAT 201.""" if not frappe.db.get_value("Custom Role", dict(report="UAE VAT 201")): frappe.get_doc( - dict( - doctype="Custom Role", - report="UAE VAT 201", - roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")], - ) + doctype="Custom Role", + report="UAE VAT 201", + roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")], ).insert() diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 85bb04c3409..2e7b7233fb1 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -104,28 +104,24 @@ class TestCustomer(IntegrationTestCase): self.assertEqual(details.tax_category, "_Test Tax Category 1") billing_address = frappe.get_doc( - dict( - doctype="Address", - address_title="_Test Address With Tax Category", - tax_category="_Test Tax Category 2", - address_type="Billing", - address_line1="Station Road", - city="_Test City", - country="India", - links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], - ) + doctype="Address", + address_title="_Test Address With Tax Category", + tax_category="_Test Tax Category 2", + address_type="Billing", + address_line1="Station Road", + city="_Test City", + country="India", + links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], ).insert() shipping_address = frappe.get_doc( - dict( - doctype="Address", - address_title="_Test Address With Tax Category", - tax_category="_Test Tax Category 3", - address_type="Shipping", - address_line1="Station Road", - city="_Test City", - country="India", - links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], - ) + doctype="Address", + address_title="_Test Address With Tax Category", + tax_category="_Test Tax Category 3", + address_type="Shipping", + address_line1="Station Road", + city="_Test City", + country="India", + links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")], ).insert() settings = frappe.get_single("Accounts Settings") diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index a3c0ef2f52d..5bdf8da738a 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -1743,18 +1743,16 @@ def make_work_orders(items, sales_order, company, project=None): frappe.throw(_("Please select Qty against item {0}").format(i.get("item_code"))) work_order = frappe.get_doc( - dict( - doctype="Work Order", - production_item=i["item_code"], - bom_no=i.get("bom"), - qty=i["pending_qty"], - company=company, - sales_order=sales_order, - sales_order_item=i["sales_order_item"], - project=project, - fg_warehouse=i["warehouse"], - description=i["description"], - ) + doctype="Work Order", + production_item=i["item_code"], + bom_no=i.get("bom"), + qty=i["pending_qty"], + company=company, + sales_order=sales_order, + sales_order_item=i["sales_order_item"], + project=project, + fg_warehouse=i["warehouse"], + description=i["description"], ).insert() work_order.set_work_order_operations() work_order.flags.ignore_mandatory = True diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index 7ff4c3e5c63..dea7b3bff97 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -2713,8 +2713,8 @@ def make_sales_order_workflow(): doc.save() return doc - frappe.get_doc(dict(doctype="Role", role_name="Test Junior Approver")).insert(ignore_if_duplicate=True) - frappe.get_doc(dict(doctype="Role", role_name="Test Approver")).insert(ignore_if_duplicate=True) + frappe.get_doc(doctype="Role", role_name="Test Junior Approver").insert(ignore_if_duplicate=True) + frappe.get_doc(doctype="Role", role_name="Test Approver").insert(ignore_if_duplicate=True) frappe.cache().hdel("roles", frappe.session.user) workflow = frappe.get_doc( diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js index 2b4b8e714ed..14d6d71a0b6 100644 --- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js +++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.js @@ -54,7 +54,7 @@ frappe.query_reports["Item-wise Sales History"] = { value = default_formatter(value, row, column, data); let format_fields = ["delivered_quantity", "billed_amount"]; - if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) { + if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) { value = "" + value + ""; } return value; diff --git a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.js b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.js index b7f7a34c1b8..3b7fa966927 100644 --- a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.js +++ b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.js @@ -96,7 +96,7 @@ frappe.query_reports["Sales Order Analysis"] = { value = default_formatter(value, row, column, data); let format_fields = ["delivered_qty", "billed_amount"]; - if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) { + if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) { value = "" + value + ""; } diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index a4cdbe223f1..f8daf3c6f31 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -257,7 +257,7 @@ erpnext.company.set_chart_of_accounts_options = function (doc) { callback: function (r) { if (!r.exc) { set_field_options("chart_of_accounts", [""].concat(r.message).join("\n")); - if (in_list(r.message, selected_value)) + if (r.message.includes(selected_value)) cur_frm.set_value("chart_of_accounts", selected_value); } }, diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 10de964d19f..c67060a8699 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -306,7 +306,7 @@ def get_batches_by_oldest(item_code, warehouse): @frappe.whitelist() def split_batch(batch_no: str, item_code: str, warehouse: str, qty: float, new_batch_id: str | None = None): """Split the batch into a new batch""" - batch = frappe.get_doc(dict(doctype="Batch", item=item_code, batch_id=new_batch_id)).insert() + batch = frappe.get_doc(doctype="Batch", item=item_code, batch_id=new_batch_id).insert() qty = flt(qty) company = frappe.db.get_value("Warehouse", warehouse, "company") @@ -330,22 +330,18 @@ def split_batch(batch_no: str, item_code: str, warehouse: str, qty: float, new_b ) stock_entry = frappe.get_doc( - dict( - doctype="Stock Entry", - purpose="Repack", - company=company, - items=[ - dict( - item_code=item_code, - qty=qty, - s_warehouse=warehouse, - serial_and_batch_bundle=from_bundle_id, - ), - dict( - item_code=item_code, qty=qty, t_warehouse=warehouse, serial_and_batch_bundle=to_bundle_id - ), - ], - ) + doctype="Stock Entry", + purpose="Repack", + company=company, + items=[ + dict( + item_code=item_code, + qty=qty, + s_warehouse=warehouse, + serial_and_batch_bundle=from_bundle_id, + ), + dict(item_code=item_code, qty=qty, t_warehouse=warehouse, serial_and_batch_bundle=to_bundle_id), + ], ) stock_entry.set_stock_entry_type() stock_entry.insert() diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py index bc06e2beb39..6154a982c98 100644 --- a/erpnext/stock/doctype/batch/test_batch.py +++ b/erpnext/stock/doctype/batch/test_batch.py @@ -45,12 +45,10 @@ class TestBatch(IntegrationTestCase): self.make_batch_item("ITEM-BATCH-1") receipt = frappe.get_doc( - dict( - doctype="Purchase Receipt", - supplier="_Test Supplier", - company="_Test Company", - items=[dict(item_code="ITEM-BATCH-1", qty=batch_qty, rate=10, warehouse="Stores - _TC")], - ) + doctype="Purchase Receipt", + supplier="_Test Supplier", + company="_Test Company", + items=[dict(item_code="ITEM-BATCH-1", qty=batch_qty, rate=10, warehouse="Stores - _TC")], ).insert() receipt.submit() @@ -66,12 +64,10 @@ class TestBatch(IntegrationTestCase): self.make_batch_item("ITEM-BATCH-1") receipt = frappe.get_doc( - dict( - doctype="Purchase Receipt", - supplier="_Test Supplier", - company="_Test Company", - items=[dict(item_code="ITEM-BATCH-1", qty=10, rate=10, warehouse="Stores - _TC")], - ) + doctype="Purchase Receipt", + supplier="_Test Supplier", + company="_Test Company", + items=[dict(item_code="ITEM-BATCH-1", qty=10, rate=10, warehouse="Stores - _TC")], ).insert() receipt.submit() @@ -96,20 +92,18 @@ class TestBatch(IntegrationTestCase): ) receipt2 = frappe.get_doc( - dict( - doctype="Purchase Receipt", - supplier="_Test Supplier", - company="_Test Company", - items=[ - dict( - item_code="ITEM-BATCH-1", - qty=20, - rate=10, - warehouse="_Test Warehouse - _TC", - serial_and_batch_bundle=bundle_id, - ) - ], - ) + doctype="Purchase Receipt", + supplier="_Test Supplier", + company="_Test Company", + items=[ + dict( + item_code="ITEM-BATCH-1", + qty=20, + rate=10, + warehouse="_Test Warehouse - _TC", + serial_and_batch_bundle=bundle_id, + ) + ], ).insert() receipt2.submit() @@ -135,20 +129,18 @@ class TestBatch(IntegrationTestCase): self.make_batch_item("ITEM-BATCH-1") stock_entry = frappe.get_doc( - dict( - doctype="Stock Entry", - purpose="Material Receipt", - company="_Test Company", - items=[ - dict( - item_code="ITEM-BATCH-1", - qty=90, - t_warehouse="_Test Warehouse - _TC", - cost_center="Main - _TC", - rate=10, - ) - ], - ) + doctype="Stock Entry", + purpose="Material Receipt", + company="_Test Company", + items=[ + dict( + item_code="ITEM-BATCH-1", + qty=90, + t_warehouse="_Test Warehouse - _TC", + cost_center="Main - _TC", + rate=10, + ) + ], ) stock_entry.set_stock_entry_type() @@ -187,20 +179,18 @@ class TestBatch(IntegrationTestCase): ) delivery_note = frappe.get_doc( - dict( - doctype="Delivery Note", - customer="_Test Customer", - company=receipt.company, - items=[ - dict( - item_code=item_code, - qty=batch_qty, - rate=10, - warehouse=receipt.items[0].warehouse, - serial_and_batch_bundle=bundle_id, - ) - ], - ) + doctype="Delivery Note", + customer="_Test Customer", + company=receipt.company, + items=[ + dict( + item_code=item_code, + qty=batch_qty, + rate=10, + warehouse=receipt.items[0].warehouse, + serial_and_batch_bundle=bundle_id, + ) + ], ).insert() delivery_note.submit() @@ -261,19 +251,17 @@ class TestBatch(IntegrationTestCase): ) stock_entry = frappe.get_doc( - dict( - doctype="Stock Entry", - purpose="Material Issue", - company=receipt.company, - items=[ - dict( - item_code=item_code, - qty=batch_qty, - s_warehouse=receipt.items[0].warehouse, - serial_and_batch_bundle=bundle_id, - ) - ], - ) + doctype="Stock Entry", + purpose="Material Issue", + company=receipt.company, + items=[ + dict( + item_code=item_code, + qty=batch_qty, + s_warehouse=receipt.items[0].warehouse, + serial_and_batch_bundle=bundle_id, + ) + ], ) stock_entry.set_stock_entry_type() @@ -373,7 +361,7 @@ class TestBatch(IntegrationTestCase): """Make a new stock entry for given target warehouse and batch name of item""" if not frappe.db.exists("Batch", batch_name): - batch = frappe.get_doc(dict(doctype="Batch", item=item_name, batch_id=batch_name)).insert( + batch = frappe.get_doc(doctype="Batch", item=item_name, batch_id=batch_name).insert( ignore_permissions=True ) batch.save() @@ -393,22 +381,20 @@ class TestBatch(IntegrationTestCase): ).make_serial_and_batch_bundle() stock_entry = frappe.get_doc( - dict( - doctype="Stock Entry", - purpose="Material Receipt", - company="_Test Company", - items=[ - dict( - item_code=item_name, - qty=90, - serial_and_batch_bundle=sn_doc.name, - t_warehouse=warehouse, - cost_center="Main - _TC", - rate=10, - allow_zero_valuation_rate=1, - ) - ], - ) + doctype="Stock Entry", + purpose="Material Receipt", + company="_Test Company", + items=[ + dict( + item_code=item_name, + qty=90, + serial_and_batch_bundle=sn_doc.name, + t_warehouse=warehouse, + cost_center="Main - _TC", + rate=10, + allow_zero_valuation_rate=1, + ) + ], ) stock_entry.set_stock_entry_type() diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js index 1b5f4a5743f..f3d60548b65 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js @@ -56,7 +56,7 @@ frappe.ui.form.on("Inventory Dimension", { ]; frm.fields.forEach((field) => { - if (!in_list(allow_to_edit_fields, field.df.fieldname)) { + if (!allow_to_edit_fields.includes(field.df.fieldname)) { frm.set_df_property(field.df.fieldname, "read_only", "1"); } }); diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index eb251dbf2c5..56cdb427acd 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -1089,9 +1089,9 @@ function open_form(frm, doctype, child_doctype, parentfield) { let new_child_doc = frappe.model.add_child(new_doc, child_doctype, parentfield); new_child_doc.item_code = frm.doc.name; new_child_doc.item_name = frm.doc.item_name; - if (in_list(SALES_DOCTYPES, doctype) && frm.doc.sales_uom) { + if (SALES_DOCTYPES.includes(doctype) && frm.doc.sales_uom) { new_child_doc.uom = frm.doc.sales_uom; - } else if (in_list(PURCHASE_DOCTYPES, doctype) && frm.doc.purchase_uom) { + } else if (PURCHASE_DOCTYPES.includes(doctype) && frm.doc.purchase_uom) { new_child_doc.uom = frm.doc.purchase_uom; } else { new_child_doc.uom = frm.doc.stock_uom; diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js index d906b85a031..6807177e582 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js @@ -30,9 +30,9 @@ frappe.ui.form.on("Item Variant Settings", { field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`; if ( - !in_list(exclude_field_types, d.fieldtype) && + !exclude_field_types.includes(d.fieldtype) && !d.no_copy && - !in_list(exclude_fields, d.fieldname) + !exclude_fields.includes(d.fieldname) ) { allow_fields.push({ label: field_label_map[d.fieldname], diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index d113ccdf7f1..65161699807 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -1290,10 +1290,11 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle // Clear Work Order record from locals, because it is updated via Stock Entry if ( this.frm.doc.work_order && - in_list( - ["Manufacture", "Material Transfer for Manufacture", "Material Consumption for Manufacture"], - this.frm.doc.purpose - ) + [ + "Manufacture", + "Material Transfer for Manufacture", + "Material Consumption for Manufacture", + ].includes(this.frm.doc.purpose) ) { frappe.model.remove_from_locals("Work Order", this.frm.doc.work_order); } diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.py b/erpnext/stock/doctype/stock_settings/test_stock_settings.py index 138cb536995..18c523f9998 100644 --- a/erpnext/stock/doctype/stock_settings/test_stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.py @@ -13,12 +13,10 @@ class TestStockSettings(IntegrationTestCase): def test_settings(self): item = frappe.get_doc( - dict( - doctype="Item", - item_code="Item for description test", - item_group="Products", - description='

Drawing No. 07-xxx-PO132
1800 x 1685 x 750
All parts made of Marine Ply
Top w/ Corian dd
CO, CS, VIP Day Cabin

', - ) + doctype="Item", + item_code="Item for description test", + item_group="Products", + description='

Drawing No. 07-xxx-PO132
1800 x 1685 x 750
All parts made of Marine Ply
Top w/ Corian dd
CO, CS, VIP Day Cabin

', ).insert() settings = frappe.get_single("Stock Settings") @@ -40,12 +38,10 @@ class TestStockSettings(IntegrationTestCase): settings.save() item = frappe.get_doc( - dict( - doctype="Item", - item_code="Item for description test", - item_group="Products", - description='

Drawing No. 07-xxx-PO132
1800 x 1685 x 750
All parts made of Marine Ply
Top w/ Corian dd
CO, CS, VIP Day Cabin

', - ) + doctype="Item", + item_code="Item for description test", + item_group="Products", + description='

Drawing No. 07-xxx-PO132
1800 x 1685 x 750
All parts made of Marine Ply
Top w/ Corian dd
CO, CS, VIP Day Cabin

', ).insert() self.assertEqual( diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py index 15af9f0f014..164a52f58c2 100644 --- a/erpnext/templates/utils.py +++ b/erpnext/templates/utils.py @@ -26,17 +26,15 @@ def send_message(sender, message, subject="Website Query"): lead = frappe.db.get_value("Lead", dict(email_id=sender)) if not lead: new_lead = frappe.get_doc( - dict(doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title()) + doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title() ).insert(ignore_permissions=True) opportunity = frappe.get_doc( - dict( - doctype="Opportunity", - opportunity_from="Customer" if customer else "Lead", - status="Open", - title=subject, - contact_email=sender, - ) + doctype="Opportunity", + opportunity_from="Customer" if customer else "Lead", + status="Open", + title=subject, + contact_email=sender, ) if customer: