mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 15:29:30 +00:00
fix: refresh posting date confirmation setting
(cherry picked from commit bcade8f0ba)
This commit is contained in:
@@ -221,6 +221,13 @@ class AccountsSettings(Document):
|
||||
set_allow_on_submit_for_dimension_fields(doctypes)
|
||||
|
||||
|
||||
@frappe.whitelist(methods=["POST"])
|
||||
def get_posting_date_confirmation() -> int:
|
||||
return cint(
|
||||
frappe.db.get_single_value("Accounts Settings", "confirm_before_resetting_posting_date", cache=False)
|
||||
)
|
||||
|
||||
|
||||
def toggle_accounting_dimension_sections(hide):
|
||||
accounting_dimension_doctypes = frappe.get_hooks("accounting_dimension_doctypes")
|
||||
for doctype in accounting_dimension_doctypes:
|
||||
|
||||
@@ -2,10 +2,16 @@ import unittest
|
||||
|
||||
import frappe
|
||||
|
||||
from erpnext.accounts.doctype.accounts_settings.accounts_settings import get_posting_date_confirmation
|
||||
from erpnext.tests.utils import ERPNextTestSuite
|
||||
|
||||
|
||||
class TestAccountsSettings(ERPNextTestSuite):
|
||||
def test_posting_date_confirmation_uses_current_setting(self):
|
||||
for enabled in (0, 1, 0):
|
||||
frappe.db.set_single_value("Accounts Settings", "confirm_before_resetting_posting_date", enabled)
|
||||
self.assertEqual(get_posting_date_confirmation(), enabled)
|
||||
|
||||
def test_stale_days(self):
|
||||
cur_settings = frappe.get_doc("Accounts Settings", "Accounts Settings")
|
||||
cur_settings.allow_stale = 0
|
||||
|
||||
@@ -1132,7 +1132,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
if (this.frm.doc.set_posting_time) return;
|
||||
if (frappe.datetime.get_today() == this.frm.doc.posting_date) return;
|
||||
|
||||
if (!frappe.boot.sysdefaults.confirm_before_resetting_posting_date) return;
|
||||
const is_confirmation_reqd = await frappe.xcall(
|
||||
"erpnext.accounts.doctype.accounts_settings.accounts_settings.get_posting_date_confirmation"
|
||||
);
|
||||
if (!is_confirmation_reqd) return;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
frappe.confirm(
|
||||
|
||||
@@ -27,9 +27,6 @@ def boot_session(bootinfo):
|
||||
bootinfo.sysdefaults.disable_include_dimensions = cint(
|
||||
frappe.get_single_value("Accounts Settings", "disable_include_dimensions")
|
||||
)
|
||||
bootinfo.sysdefaults.confirm_before_resetting_posting_date = cint(
|
||||
frappe.get_single_value("Accounts Settings", "confirm_before_resetting_posting_date")
|
||||
)
|
||||
|
||||
bootinfo.sysdefaults.quotation_valid_till = cint(
|
||||
frappe.db.get_single_value("CRM Settings", "default_valid_till")
|
||||
|
||||
Reference in New Issue
Block a user