diff --git a/frappe/__init__.py b/frappe/__init__.py index c9b2c2edb9..0d009b426f 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -633,11 +633,11 @@ def write_only(): # if replica connection exists, we have to replace it momentarily with the primary connection def innfn(fn): def wrapper_fn(*args, **kwargs): - # switch to primary connection primary_db = getattr(local, "primary_db", None) replica_db = getattr(local, "replica_db", None) in_read_only = getattr(local, "db", None) != primary_db + # switch to primary connection if in_read_only and primary_db: local.db = local.primary_db diff --git a/frappe/core/doctype/access_log/access_log.py b/frappe/core/doctype/access_log/access_log.py index 0f5776ce2f..d93da02d25 100644 --- a/frappe/core/doctype/access_log/access_log.py +++ b/frappe/core/doctype/access_log/access_log.py @@ -9,6 +9,7 @@ class AccessLog(Document): @frappe.whitelist() +@frappe.write_only() def make_access_log(doctype=None, document=None, method=None, file_type=None, report_name=None, filters=None, page=None, columns=None):