mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
Merge pull request #31797 from frappe/mergify/bp/version-13-hotfix/pr-31779
Bug add accouting dimension in asset repair (backport #31779)
This commit is contained in:
@@ -589,6 +589,7 @@ accounting_dimension_doctypes = [
|
|||||||
"Shipping Rule",
|
"Shipping Rule",
|
||||||
"Landed Cost Item",
|
"Landed Cost Item",
|
||||||
"Asset Value Adjustment",
|
"Asset Value Adjustment",
|
||||||
|
"Asset Repair",
|
||||||
"Loyalty Program",
|
"Loyalty Program",
|
||||||
"Fee Schedule",
|
"Fee Schedule",
|
||||||
"Fee Structure",
|
"Fee Structure",
|
||||||
|
|||||||
@@ -372,3 +372,4 @@ erpnext.patches.v13_0.show_india_localisation_deprecation_warning
|
|||||||
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
|
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
|
||||||
erpnext.patches.v13_0.reset_corrupt_defaults
|
erpnext.patches.v13_0.reset_corrupt_defaults
|
||||||
erpnext.patches.v13_0.show_hr_payroll_deprecation_warning
|
erpnext.patches.v13_0.show_hr_payroll_deprecation_warning
|
||||||
|
erpnext.patches.v13_0.create_accounting_dimensions_for_asset_repair
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
accounting_dimensions = frappe.db.get_all(
|
||||||
|
"Accounting Dimension", fields=["fieldname", "label", "document_type", "disabled"]
|
||||||
|
)
|
||||||
|
|
||||||
|
if not accounting_dimensions:
|
||||||
|
return
|
||||||
|
|
||||||
|
for d in accounting_dimensions:
|
||||||
|
doctype = "Asset Repair"
|
||||||
|
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})
|
||||||
|
|
||||||
|
if field:
|
||||||
|
continue
|
||||||
|
|
||||||
|
df = {
|
||||||
|
"fieldname": d.fieldname,
|
||||||
|
"label": d.label,
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": d.document_type,
|
||||||
|
"insert_after": "accounting_dimensions_section",
|
||||||
|
}
|
||||||
|
|
||||||
|
create_custom_field(doctype, df, ignore_validate=True)
|
||||||
|
frappe.clear_cache(doctype=doctype)
|
||||||
Reference in New Issue
Block a user