refactor: rename get_settings -> get_single_value (#47961)

This commit is contained in:
Ankush Menat
2025-06-09 10:10:02 +05:30
committed by GitHub
parent 26abf9f13a
commit 765c7c2bcc
55 changed files with 177 additions and 156 deletions

View File

@@ -518,7 +518,7 @@ class StockController(AccountsController):
)
def set_use_serial_batch_fields(self):
if frappe.get_settings("Stock Settings", "use_serial_batch_fields"):
if frappe.get_single_value("Stock Settings", "use_serial_batch_fields"):
for row in self.items:
row.use_serial_batch_fields = 1
@@ -1076,7 +1076,7 @@ class StockController(AccountsController):
"Purchase Invoice",
"Sales Invoice",
"Delivery Note",
] and frappe.get_settings(
] and frappe.get_single_value(
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
):
return
@@ -1092,7 +1092,7 @@ class StockController(AccountsController):
def validate_qi_submission(self, row):
"""Check if QI is submitted on row level, during submission"""
action = frappe.get_settings("Stock Settings", "action_if_quality_inspection_is_not_submitted")
action = frappe.get_single_value("Stock Settings", "action_if_quality_inspection_is_not_submitted")
qa_docstatus = frappe.db.get_value("Quality Inspection", row.quality_inspection, "docstatus")
if qa_docstatus != 1:
@@ -1107,7 +1107,7 @@ class StockController(AccountsController):
def validate_qi_rejection(self, row):
"""Check if QI is rejected on row level, during submission"""
action = frappe.get_settings("Stock Settings", "action_if_quality_inspection_is_rejected")
action = frappe.get_single_value("Stock Settings", "action_if_quality_inspection_is_rejected")
qa_status = frappe.db.get_value("Quality Inspection", row.quality_inspection, "status")
if qa_status == "Rejected":
@@ -1206,7 +1206,7 @@ class StockController(AccountsController):
item_wise_received_qty = self.get_item_wise_inter_received_qty()
precision = frappe.get_precision(self.doctype + " Item", "qty")
over_receipt_allowance = frappe.get_settings("Stock Settings", "over_delivery_receipt_allowance")
over_receipt_allowance = frappe.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
parent_doctype = {
"Purchase Receipt": "Delivery Note",
@@ -1379,7 +1379,7 @@ class StockController(AccountsController):
force = True
if force or future_sle_exists(args) or repost_required_for_queue(self):
item_based_reposting = frappe.get_settings("Stock Reposting Settings", "item_based_reposting")
item_based_reposting = frappe.get_single_value("Stock Reposting Settings", "item_based_reposting")
if item_based_reposting:
create_item_wise_repost_entries(
voucher_type=self.doctype,
@@ -1671,7 +1671,7 @@ def is_reposting_pending():
def future_sle_exists(args, sl_entries=None, allow_force_reposting=True):
from erpnext.stock.utils import get_combine_datetime
if allow_force_reposting and frappe.get_settings(
if allow_force_reposting and frappe.get_single_value(
"Stock Reposting Settings", "do_reposting_for_each_stock_transaction"
):
return True