refactor: limit reposting to only supported doctypes

(cherry picked from commit 940d3cfe0a)
This commit is contained in:
ruthra kumar
2026-04-15 12:15:31 +05:30
parent fa5e4dee17
commit 5a2933df8f
3 changed files with 17 additions and 1 deletions

View File

@@ -2,7 +2,15 @@
// For license information, please see license.txt
frappe.ui.form.on("Accounts Settings", {
refresh: function (frm) {},
refresh: function (frm) {
frm.set_query("document_type", "repost_allowed_types", function (doc, cdt, cdn) {
return {
filters: {
name: ["in", frappe.boot.sysdefaults.repost_allowed_doctypes],
},
};
});
},
enable_immutable_ledger: function (frm) {
if (!frm.doc.enable_immutable_ledger) {
return;

View File

@@ -692,3 +692,10 @@ fields_for_group_similar_items = ["qty", "amount"]
# ------------
# List of apps whose translatable strings should be excluded from this app's translations.
ignore_translatable_strings_from = ["frappe"]
repost_allowed_doctypes = [
"Sales Invoice",
"Purchase Invoice",
"Journal Entry",
"Payment Entry",
"Purchase Receipt",
]

View File

@@ -66,6 +66,7 @@ def boot_session(bootinfo):
bootinfo.sysdefaults.default_ageing_range = frappe.db.get_single_value(
"Accounts Settings", "default_ageing_range"
)
bootinfo.sysdefaults.repost_allowed_doctypes = frappe.get_hooks("repost_allowed_doctypes")
def update_page_info(bootinfo):