mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-21 19:25:16 +00:00
fix: handle default accounting dimension
(cherry picked from commit 16e440f9a7)
This commit is contained in:
@@ -38,7 +38,8 @@ class AccountingDimensionFilter(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.fieldname = frappe.db.get_value(
|
self.fieldname = frappe.db.get_value(
|
||||||
"Accounting Dimension", {"document_type": self.accounting_dimension}, "fieldname"
|
"Accounting Dimension", {"document_type": self.accounting_dimension}, "fieldname"
|
||||||
)
|
) or frappe.scrub(self.accounting_dimension) # scrub to handle default accounting dimension
|
||||||
|
|
||||||
self.validate_applicable_accounts()
|
self.validate_applicable_accounts()
|
||||||
|
|
||||||
def validate_applicable_accounts(self):
|
def validate_applicable_accounts(self):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from frappe.query_builder import DocType
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
default_accounting_dimension()
|
||||||
ADF = DocType("Accounting Dimension Filter")
|
ADF = DocType("Accounting Dimension Filter")
|
||||||
AD = DocType("Accounting Dimension")
|
AD = DocType("Accounting Dimension")
|
||||||
|
|
||||||
@@ -21,3 +22,14 @@ def execute():
|
|||||||
doc.fieldname,
|
doc.fieldname,
|
||||||
update_modified=False,
|
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