-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Accounting Dimension updation in Payment Request and Entry (#33411
- Loading branch information
1 parent
7a98ece
commit e7704b2
Showing
5 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
erpnext/patches/v14_0/create_accounting_dimensions_for_payment_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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 | ||
|
||
doctype = "Payment Request" | ||
|
||
for d in accounting_dimensions: | ||
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) |