mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 03:35:43 +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)
|
frappe.qb.from_(ADF)
|
||||||
.join(AD)
|
.join(AD)
|
||||||
.on(AD.document_type == ADF.accounting_dimension)
|
.on(AD.document_type == ADF.accounting_dimension)
|
||||||
.select(ADF.name, AD.fieldname)
|
.select(ADF.name, AD.fieldname, ADF.accounting_dimension)
|
||||||
).run(as_dict=True)
|
).run(as_dict=True)
|
||||||
|
|
||||||
for doc in accounting_dimension_filter:
|
for doc in accounting_dimension_filter:
|
||||||
|
value = doc.fieldname or frappe.scrub(doc.accounting_dimension)
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Accounting Dimension Filter",
|
"Accounting Dimension Filter",
|
||||||
doc.name,
|
doc.name,
|
||||||
"fieldname",
|
"fieldname",
|
||||||
doc.fieldname,
|
value,
|
||||||
update_modified=False,
|
update_modified=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def default_accounting_dimension():
|
def default_accounting_dimension():
|
||||||
for accounting_dimension in ["Cost Center", "Project"]:
|
ADF = DocType("Accounting Dimension Filter")
|
||||||
frappe.db.set_value(
|
for dim in ("Cost Center", "Project"):
|
||||||
"Accounting Dimension Filter",
|
(
|
||||||
{"accounting_dimension": accounting_dimension},
|
frappe.qb.update(ADF)
|
||||||
"fieldname",
|
.set(ADF.fieldname, frappe.scrub(dim))
|
||||||
frappe.scrub(accounting_dimension),
|
.where(ADF.accounting_dimension == dim)
|
||||||
update_modified=False,
|
.run()
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user