fix: wrong usage of get_single_value (#39268)

* fix: wrong usage of get_single_value

* test: fix wrong fieldname

* chore: typo

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
Raffael Meyer 2024-01-10 08:02:27 +01:00 committed by GitHub
parent 38c5ecf007
commit 6f9fe6a792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 14 deletions

View File

@ -1238,10 +1238,10 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_gain_loss_with_advance_entry(self):
unlink_enabled = frappe.db.get_single_value(
"Accounts Settings", "unlink_payment_on_cancel_of_invoice"
"Accounts Settings", "unlink_payment_on_cancellation_of_invoice"
)
frappe.db.set_single_value("Accounts Settings", "unlink_payment_on_cancel_of_invoice", 1)
frappe.db.set_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 1)
original_account = frappe.db.get_value("Company", "_Test Company", "exchange_gain_loss_account")
frappe.db.set_value(
@ -1432,7 +1432,7 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
pay.cancel()
frappe.db.set_single_value(
"Accounts Settings", "unlink_payment_on_cancel_of_invoice", unlink_enabled
"Accounts Settings", "unlink_payment_on_cancellation_of_invoice", unlink_enabled
)
frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account)

View File

@ -2,11 +2,7 @@ import frappe
def execute():
settings = frappe.db.get_single_value(
"Selling Settings",
["campaign_naming_by", "close_opportunity_after_days", "default_valid_till"],
as_dict=True,
)
settings = frappe.db.get_singles_dict("Selling Settings", cast=True)
frappe.reload_doc("crm", "doctype", "crm_settings")
if settings:

View File

@ -140,7 +140,7 @@ class RepostItemValuation(Document):
return query[0][0] if query else None
def validate_accounts_freeze(self):
acc_settings = frappe.get_cached_doc("Account Settings")
acc_settings = frappe.get_cached_doc("Accounts Settings")
if not acc_settings.acc_frozen_upto:
return
if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto):

View File

@ -78,13 +78,11 @@ def get_frequency(value):
def update_youtube_data():
# Called every 30 minutes via hooks
enable_youtube_tracking = frappe.db.get_single_value("Video Settings", "enable_youtube_tracking")
frequency = frappe.db.get_single_value("Video Settings", "frequency")
if not cint(enable_youtube_tracking):
video_settings = frappe.get_cached_doc("Video Settings")
if not video_settings.enable_youtube_tracking:
return
frequency = get_frequency(frequency)
frequency = get_frequency(video_settings.frequency)
time = datetime.now()
timezone = pytz.timezone(get_system_timezone())
site_time = time.astimezone(timezone)