mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 00:55:02 +00:00
fix: handle default dimension for all company
(cherry picked from commit 77021fff74)
This commit is contained in:
@@ -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()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user