Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace set_value usage with set_single_value #35666

Closed
ankush opened this issue Jun 13, 2023 · 0 comments · Fixed by #35668
Closed

replace set_value usage with set_single_value #35666

ankush opened this issue Jun 13, 2023 · 0 comments · Fixed by #35668
Labels

Comments

@ankush
Copy link
Member

ankush commented Jun 13, 2023

Required after frappe/frappe#21316

λ semgrep  --severity=INFO --config=~/proj/semgrep-rules/rules/ .
Scanning 2367 files.
  100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|2367/2367 tasks

Blocking Findings:

  erpnext/accounts/doctype/fiscal_year/fiscal_year.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Global Defaults" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         15┆ frappe.db.set_value("Global Defaults", None, "current_fiscal_year", self.name)


  erpnext/accounts/doctype/journal_entry/test_journal_entry.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

        108┆ frappe.db.set_value(
        109┆    "Accounts Settings", "Accounts Settings", "unlink_advance_payment_on_cancelation_of_order", 0
        110┆ )


  erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Selling Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         34┆ frappe.db.set_value("Selling Settings", None, "validate_selling_price", 0)
          ⋮┆----------------------------------------
        725┆ frappe.db.set_value("Selling Settings", "Selling Settings", "validate_selling_price", 1)


  erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         45┆ frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

       1235┆ frappe.db.set_value(
       1236┆    "Accounts Settings", "Accounts Settings", "unlink_payment_on_cancel_of_invoice", 1
       1237┆ )
          ⋮┆----------------------------------------
       1372┆ frappe.db.set_value(
       1373┆    "Accounts Settings", "Accounts Settings", "unlink_payment_on_cancel_of_invoice", unlink_enabled
       1374┆ )


  erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

       1066┆ frappe.db.set_value("Accounts Settings", None, "post_change_gl_entries", 0)
          ⋮┆----------------------------------------
       1116┆ frappe.db.set_value("Accounts Settings", None, "post_change_gl_entries", 1)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

       2455┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
       2509┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", old_negative_stock)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

       2901┆ frappe.db.set_value("Accounts Settings", None, "enable_common_party_accounting", 1)
          ⋮┆----------------------------------------
       2928┆ frappe.db.set_value("Accounts Settings", None, "enable_common_party_accounting", 0)
          ⋮┆----------------------------------------
       3048┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", add_days(getdate(), 1))
          ⋮┆----------------------------------------
       3057┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)
          ⋮┆----------------------------------------
       3069┆ frappe.db.set_value("Accounts Settings", None, "over_billing_allowance", 0)
          ⋮┆----------------------------------------
       3085┆ frappe.db.set_value("Accounts Settings", None, "over_billing_allowance", over_billing_allowance)
          ⋮┆----------------------------------------
       3124┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", getdate("2019-01-31"))
          ⋮┆----------------------------------------
       3169┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)
          ⋮┆----------------------------------------
       3219┆ frappe.db.set_value(
       3220┆    "Accounts Settings", "Accounts Settings", "unlink_payment_on_cancel_of_invoice", 1
       3221┆ )
          ⋮┆----------------------------------------
       3264┆ frappe.db.set_value(
       3265┆    "Accounts Settings", "Accounts Settings", "unlink_payment_on_cancel_of_invoice", unlink_enabled
       3266┆ )


  erpnext/accounts/doctype/tax_rule/test_tax_rule.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Shopping Cart Settings" is a single doctype then using `frappe.db.set_value` is
        discouraged for setting values in DB. Use db.set_single_value for single doctype instead.

         18┆ frappe.db.set_value("Shopping Cart Settings", None, "enabled", 0)


  erpnext/assets/doctype/asset/test_asset.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

       1807┆ frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)


  erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

        185┆ frappe.db.set_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically", 1)


  erpnext/buying/doctype/purchase_order/test_purchase_order.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         95┆ frappe.db.set_value("Accounts Settings", None, "over_billing_allowance", 0)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        584┆ frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Selling Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

        839┆ frappe.db.set_value("Selling Settings", None, "maintain_same_sales_rate", 1)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        840┆ frappe.db.set_value("Buying Settings", None, "maintain_same_rate", 1)


  erpnext/buying/doctype/supplier/test_supplier.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        159┆ frappe.db.set_value("Buying Settings", None, "supp_master_name", "Naming Series")
          ⋮┆----------------------------------------
        192┆ frappe.db.set_value("Buying Settings", None, "supp_master_name", "Supplier Name")


  erpnext/controllers/tests/test_subcontracting_controller.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

       1077┆ frappe.db.set_value(
       1078┆    "Buying Settings", None, "backflush_raw_materials_of_subcontract_based_on", based_on
       1079┆ )


  erpnext/crm/doctype/opportunity/test_opportunity.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "CRM Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         56┆ frappe.db.set_value(
         57┆    "CRM Settings", "CRM Settings", "carry_forward_communication_and_comments", 1
         58┆ )


  erpnext/e_commerce/shopping_cart/test_shopping_cart.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "E Commerce Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

        208┆ frappe.db.set_value("E Commerce Settings", None, "save_quotations_as_draft", 0)


  erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Plaid Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         35┆ frappe.db.set_value("Plaid Settings", None, "enabled", 0)


  erpnext/manufacturing/doctype/work_order/test_work_order.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Manufacturing Settings" is a single doctype then using `frappe.db.set_value` is
        discouraged for setting values in DB. Use db.set_single_value for single doctype instead.

        506┆ frappe.db.set_value(
        507┆    "Manufacturing Settings",
        508┆    None,
        509┆    {"disable_capacity_planning": 0, "capacity_planning_for_days": 1},
        510┆ )
          ⋮┆----------------------------------------
        532┆ frappe.db.set_value("Manufacturing Settings", None, {"capacity_planning_for_days": 30})
          ⋮┆----------------------------------------
        542┆ frappe.db.set_value("Manufacturing Settings", None, "backflush_raw_materials_based_on", "BOM")
          ⋮┆----------------------------------------
        622┆ frappe.db.set_value("Manufacturing Settings", None, "make_serial_no_batch_from_work_order", 0)
          ⋮┆----------------------------------------
        658┆ frappe.db.set_value("Manufacturing Settings", None, "make_serial_no_batch_from_work_order", 1)
          ⋮┆----------------------------------------
        702┆ frappe.db.set_value("Manufacturing Settings", None, "make_serial_no_batch_from_work_order", 0)
          ⋮┆----------------------------------------
        705┆ frappe.db.set_value("Manufacturing Settings", None, "material_consumption", 1)
          ⋮┆----------------------------------------
        739┆ frappe.db.set_value("Manufacturing Settings", None, "material_consumption", 0)
          ⋮┆----------------------------------------
        742┆ frappe.db.set_value("Manufacturing Settings", None, "material_consumption", 0)
          ⋮┆----------------------------------------
        743┆ frappe.db.set_value(
        744┆    "Manufacturing Settings",
        745┆    None,
        746┆    "backflush_raw_materials_based_on",
        747┆    "Material Transferred for Manufacture",
        748┆ )
          ⋮┆----------------------------------------
        790┆ frappe.db.set_value("Manufacturing Settings", None, "backflush_raw_materials_based_on", "BOM")
          ⋮┆----------------------------------------
       1090┆ frappe.db.set_value(
       1091┆    "Manufacturing Settings",
       1092┆    None,
       1093┆    "backflush_raw_materials_based_on",
       1094┆    "Material Transferred for Manufacture",
       1095┆ )
          ⋮┆----------------------------------------
       1142┆ frappe.db.set_value("Manufacturing Settings", None, "backflush_raw_materials_based_on", "BOM")
          ⋮┆----------------------------------------
       1286┆ frappe.db.set_value(
       1287┆    "Manufacturing Settings",
       1288┆    None,
       1289┆    "backflush_raw_materials_based_on",
       1290┆    "Material Transferred for Manufacture",
       1291┆ )
          ⋮┆----------------------------------------
       1359┆ frappe.db.set_value(
       1360┆    "Manufacturing Settings",
       1361┆    None,
       1362┆    "backflush_raw_materials_based_on",
       1363┆    "Material Transferred for Manufacture",
       1364┆ )
          ⋮┆----------------------------------------
       1403┆ frappe.db.set_value(
       1404┆    "Manufacturing Settings",
       1405┆    None,
       1406┆    "backflush_raw_materials_based_on",
       1407┆    "Material Transferred for Manufacture",
       1408┆ )
          ⋮┆----------------------------------------
       1489┆ frappe.db.set_value(
       1490┆    "Manufacturing Settings",
       1491┆    None,
       1492┆    "backflush_raw_materials_based_on",
       1493┆    "Material Transferred for Manufacture",
       1494┆ )


  erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         10┆ frappe.db.set_value(
         11┆    "Buying Settings", None, "backflush_raw_materials_of_subcontract_based_on", "BOM"
         12┆ )


  erpnext/patches/v12_0/rename_tolerance_fields.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         14┆ frappe.db.set_value("Accounts Settings", None, "over_delivery_receipt_allowance", qty_allowance)


  erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

          7┆ frappe.db.set_value(
          8┆    "Accounts Settings", None, "automatically_process_deferred_accounting_entry", 1
          9┆ )


  erpnext/patches/v12_0/set_default_homepage_type.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Homepage" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

          5┆ frappe.db.set_value("Homepage", "Homepage", "hero_section_based_on", "Default")


  erpnext/patches/v12_0/set_priority_for_support.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Support Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         49┆ frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)


  erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         50┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)
          ⋮┆----------------------------------------
         68┆ frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", acc_frozen_upto)


  erpnext/patches/v14_0/discount_accounting_separation.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If doctype is a single doctype then using `frappe.db.set_value` is discouraged for setting
        values in DB. Use db.set_single_value for single doctype instead.

         11┆ frappe.db.set_value(doctype, doctype, "enable_discount_accounting", 1, update_modified=False)


  erpnext/patches/v14_0/migrate_crm_settings.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "CRM Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         14┆ frappe.db.set_value(
         15┆    "CRM Settings",
         16┆    "CRM Settings",
         17┆    {
         18┆            "campaign_naming_by": settings.campaign_naming_by,
         19┆            "close_opportunity_after_days": settings.close_opportunity_after_days,
         20┆            "default_valid_till": settings.default_valid_till,
         21┆    },
         22┆ )


  erpnext/selling/doctype/customer/test_customer.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Selling Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

        348┆ frappe.db.set_value("Selling Settings", None, "cust_master_name", "Naming Series")
          ⋮┆----------------------------------------
        374┆ frappe.db.set_value("Selling Settings", None, "cust_master_name", "Customer Name")


  erpnext/selling/doctype/sales_order/test_sales_order.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         46┆ frappe.db.set_value(
         47┆    "Accounts Settings",
         48┆    "Accounts Settings",
         49┆    "unlink_advance_payment_on_cancelation_of_order",
         50┆    cls.unlink_setting,
         51┆ )
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        708┆ frappe.db.set_value("Stock Settings", None, "default_warehouse", "_Test Warehouse - _TC")
          ⋮┆----------------------------------------
        744┆ frappe.db.set_value("Stock Settings", None, "default_warehouse", old_stock_settings_value)
          ⋮┆----------------------------------------
        823┆ frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
          ⋮┆----------------------------------------
        864┆ frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 0)
          ⋮┆----------------------------------------
        885┆ frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

       1260┆ frappe.db.set_value(
       1261┆    "Accounts Settings", "Accounts Settings", "unlink_advance_payment_on_cancelation_of_order", 0
       1262┆ )
          ⋮┆----------------------------------------
       1315┆ frappe.db.set_value(
       1316┆    "Accounts Settings", "Accounts Settings", "unlink_advance_payment_on_cancelation_of_order", 0
       1317┆ )
          ⋮┆----------------------------------------
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

       2083┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)


  erpnext/setup/doctype/currency_exchange/test_currency_exchange.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Accounts Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         90┆ frappe.db.set_value("Accounts Settings", None, "allow_stale", 1)
          ⋮┆----------------------------------------
         96┆ frappe.db.set_value("Accounts Settings", None, "allow_stale", 1)
          ⋮┆----------------------------------------
        127┆ frappe.db.set_value("Accounts Settings", None, "allow_stale", 1)
          ⋮┆----------------------------------------
        155┆ frappe.db.set_value("Accounts Settings", None, "allow_stale", 0)
          ⋮┆----------------------------------------
        156┆ frappe.db.set_value("Accounts Settings", None, "stale_days", 1)
          ⋮┆----------------------------------------
        178┆ frappe.db.set_value("Accounts Settings", None, "allow_stale", 0)
          ⋮┆----------------------------------------
        179┆ frappe.db.set_value("Accounts Settings", None, "stale_days", 1)


  erpnext/setup/install.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "System Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        193┆ frappe.db.set_value("System Settings", None, "app_name", "ERPNext")


  erpnext/stock/doctype/delivery_note/test_delivery_note.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         46┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
        712┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
        744┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)


  erpnext/stock/doctype/item/item.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        588┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
        604┆ frappe.db.set_value(
        605┆    "Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock
        606┆ )


  erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         28┆ frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)


  erpnext/stock/doctype/material_request/test_material_request.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        403┆ frappe.db.set_value("Stock Settings", None, "mr_qty_allowance", 20)


  erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Buying Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         30┆ frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)
          ⋮┆----------------------------------------
       1928┆ frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)


  erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        170┆ frappe.db.set_value("Stock Settings", None, "action_if_quality_inspection_is_rejected", "Stop")
          ⋮┆----------------------------------------
        176┆ frappe.db.set_value("Stock Settings", None, "action_if_quality_inspection_is_rejected", "Warn")
          ⋮┆----------------------------------------
        185┆ frappe.db.set_value("Stock Settings", None, "action_if_quality_inspection_is_rejected", "Stop")


  erpnext/stock/doctype/stock_entry/test_stock_entry.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         58┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
        145┆ frappe.db.set_value("Stock Settings", None, "auto_indent", 1)
          ⋮┆----------------------------------------
        157┆ frappe.db.set_value("Stock Settings", None, "auto_indent", 0)
          ⋮┆----------------------------------------
        795┆ frappe.db.set_value("Stock Settings", None, "stock_auth_role", "")
          ⋮┆----------------------------------------
        798┆ frappe.db.set_value("Stock Settings", None, "stock_frozen_upto", add_days(nowdate(), 5))
          ⋮┆----------------------------------------
        802┆ frappe.db.set_value("Stock Settings", None, "stock_frozen_upto", "")
          ⋮┆----------------------------------------
        805┆ frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", -1)
          ⋮┆----------------------------------------
        812┆ frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
          ⋮┆----------------------------------------
       1214┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)


  erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

        419┆ frappe.db.set_value(
        420┆    "Stock Settings", None, "role_allowed_to_create_edit_back_dated_transactions", "Stock Manager"
        421┆ )
          ⋮┆----------------------------------------
        456┆ frappe.db.set_value(
        457┆    "Stock Settings", None, "role_allowed_to_create_edit_back_dated_transactions", None
        458┆ )


  erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         36┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)


  erpnext/stock/doctype/stock_settings/test_stock_settings.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         13┆ frappe.db.set_value("Stock Settings", None, "clean_description_html", 0)


  erpnext/stock/stock_balance.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Stock Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         21┆ frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
          ⋮┆----------------------------------------
         40┆ frappe.db.set_value(
         41┆    "Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock
         42┆ )


  erpnext/support/doctype/issue/test_issue.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Support Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         23┆ frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)


  erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Support Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         19┆ frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)


  erpnext/support/report/issue_analytics/test_issue_analytics.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Support Settings" is a single doctype then using `frappe.db.set_value` is discouraged
        for setting values in DB. Use db.set_single_value for single doctype instead.

         20┆ frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)


  erpnext/tests/test_exotel.py
     home.ankush.proj.semgrep-rules.rules.frappe-set-value-semantics
        If "Exotel Settings" is a single doctype then using `frappe.db.set_value` is discouraged for
        setting values in DB. Use db.set_single_value for single doctype instead.

         15┆ frappe.db.set_value("Exotel Settings", "Exotel Settings", "enabled", 1)
@ankush ankush added the bug label Jun 13, 2023
@ankush ankush changed the title replcae set_value usage with set_single_value replace set_value usage with set_single_value Jun 13, 2023
@deepeshgarg007 deepeshgarg007 moved this to 🏗 In progress in ERPNext and Framework Backlog Jun 13, 2023
@ankush ankush linked a pull request Jun 13, 2023 that will close this issue
@deepeshgarg007 deepeshgarg007 moved this from 🏗 In progress to ✅ Done in ERPNext and Framework Backlog Jun 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant