mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-19 10:14:59 +00:00
fix: handle default accounting dimension
This commit is contained in:
@@ -38,7 +38,8 @@ class AccountingDimensionFilter(Document):
|
||||
def validate(self):
|
||||
self.fieldname = frappe.db.get_value(
|
||||
"Accounting Dimension", {"document_type": self.accounting_dimension}, "fieldname"
|
||||
)
|
||||
) or frappe.scrub(self.accounting_dimension) # scrub to handle default accounting dimension
|
||||
|
||||
self.validate_applicable_accounts()
|
||||
|
||||
def validate_applicable_accounts(self):
|
||||
|
||||
@@ -3,6 +3,7 @@ from frappe.query_builder import DocType
|
||||
|
||||
|
||||
def execute():
|
||||
default_accounting_dimension()
|
||||
ADF = DocType("Accounting Dimension Filter")
|
||||
AD = DocType("Accounting Dimension")
|
||||
|
||||
@@ -21,3 +22,14 @@ def execute():
|
||||
doc.fieldname,
|
||||
update_modified=False,
|
||||
)
|
||||
|
||||
|
||||
def default_accounting_dimension():
|
||||
for accounting_dimension in ["Cost Center", "Project"]:
|
||||
frappe.db.set_value(
|
||||
"Accounting Dimension Filter",
|
||||
{"accounting_dimension": accounting_dimension},
|
||||
"fieldname",
|
||||
frappe.scrub(accounting_dimension),
|
||||
update_modified=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user