mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
refactor: delete redundent repost setting
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
|
||||||
// For license information, please see license.txt
|
|
||||||
|
|
||||||
// frappe.ui.form.on("Repost Accounting Ledger Settings", {
|
|
||||||
// refresh(frm) {
|
|
||||||
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"actions": [],
|
|
||||||
"creation": "2023-11-07 09:57:20.619939",
|
|
||||||
"doctype": "DocType",
|
|
||||||
"engine": "InnoDB",
|
|
||||||
"field_order": [
|
|
||||||
"allowed_types"
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"fieldname": "allowed_types",
|
|
||||||
"fieldtype": "Table",
|
|
||||||
"label": "Allowed Doctypes",
|
|
||||||
"options": "Repost Allowed Types"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"grid_page_length": 50,
|
|
||||||
"hide_toolbar": 0,
|
|
||||||
"in_create": 1,
|
|
||||||
"issingle": 1,
|
|
||||||
"links": [],
|
|
||||||
"modified": "2026-03-16 13:28:21.312607",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"module": "Accounts",
|
|
||||||
"name": "Repost Accounting Ledger Settings",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [
|
|
||||||
{
|
|
||||||
"create": 1,
|
|
||||||
"delete": 1,
|
|
||||||
"email": 1,
|
|
||||||
"print": 1,
|
|
||||||
"read": 1,
|
|
||||||
"role": "Administrator",
|
|
||||||
"select": 1,
|
|
||||||
"share": 1,
|
|
||||||
"write": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"create": 1,
|
|
||||||
"delete": 1,
|
|
||||||
"read": 1,
|
|
||||||
"role": "System Manager",
|
|
||||||
"select": 1,
|
|
||||||
"write": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"row_format": "Dynamic",
|
|
||||||
"sort_field": "creation",
|
|
||||||
"sort_order": "DESC",
|
|
||||||
"states": [],
|
|
||||||
"track_changes": 1
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
|
||||||
# For license information, please see license.txt
|
|
||||||
|
|
||||||
import frappe
|
|
||||||
from frappe.model.document import Document
|
|
||||||
|
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
|
||||||
get_accounting_dimensions,
|
|
||||||
)
|
|
||||||
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import get_child_docs
|
|
||||||
|
|
||||||
|
|
||||||
class RepostAccountingLedgerSettings(Document):
|
|
||||||
# begin: auto-generated types
|
|
||||||
# This code is auto-generated. Do not modify anything in this block.
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from frappe.types import DF
|
|
||||||
|
|
||||||
from erpnext.accounts.doctype.repost_allowed_types.repost_allowed_types import RepostAllowedTypes
|
|
||||||
|
|
||||||
allowed_types: DF.Table[RepostAllowedTypes]
|
|
||||||
# end: auto-generated types
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
self.update_property_for_accounting_dimension()
|
|
||||||
|
|
||||||
def update_property_for_accounting_dimension(self):
|
|
||||||
doctypes = [entry.document_type for entry in self.allowed_types if entry.allowed]
|
|
||||||
if not doctypes:
|
|
||||||
return
|
|
||||||
doctypes += get_child_docs(doctypes)
|
|
||||||
|
|
||||||
set_allow_on_submit_for_dimension_fields(doctypes)
|
|
||||||
|
|
||||||
|
|
||||||
def set_allow_on_submit_for_dimension_fields(doctypes):
|
|
||||||
for dt in doctypes:
|
|
||||||
meta = frappe.get_meta(dt)
|
|
||||||
for dimension in get_accounting_dimensions():
|
|
||||||
df = meta.get_field(dimension)
|
|
||||||
if df and not df.allow_on_submit:
|
|
||||||
frappe.db.set_value("Custom Field", dt + "-" + dimension, "allow_on_submit", 1)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
|
|
||||||
# See license.txt
|
|
||||||
|
|
||||||
# import frappe
|
|
||||||
|
|
||||||
|
|
||||||
from erpnext.tests.utils import ERPNextTestSuite
|
|
||||||
|
|
||||||
|
|
||||||
class TestRepostAccountingLedgerSettings(ERPNextTestSuite):
|
|
||||||
pass
|
|
||||||
Reference in New Issue
Block a user