fix: handle default dimension for all company

(cherry picked from commit 77021fff74)
This commit is contained in:
l0gesh29
2025-08-12 14:26:18 +05:30
committed by Mergify
parent e50d6c6b62
commit 0cd45a0022

View File

@@ -11,25 +11,26 @@ def execute():
frappe.qb.from_(ADF)
.join(AD)
.on(AD.document_type == ADF.accounting_dimension)
.select(ADF.name, AD.fieldname)
.select(ADF.name, AD.fieldname, ADF.accounting_dimension)
).run(as_dict=True)
for doc in accounting_dimension_filter:
value = doc.fieldname or frappe.scrub(doc.accounting_dimension)
frappe.db.set_value(
"Accounting Dimension Filter",
doc.name,
"fieldname",
doc.fieldname,
value,
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,
ADF = DocType("Accounting Dimension Filter")
for dim in ("Cost Center", "Project"):
(
frappe.qb.update(ADF)
.set(ADF.fieldname, frappe.scrub(dim))
.where(ADF.accounting_dimension == dim)
.run()
)