diff --git a/lending/install.py b/lending/install.py index 59945c00..bea584f7 100644 --- a/lending/install.py +++ b/lending/install.py @@ -15,11 +15,17 @@ } ], "Company": [ + { + "fieldname": "loan_tab", + "fieldtype": "Tab Break", + "label": "Loan", + "insert_after": "expenses_included_in_valuation", + }, { "fieldname": "loan_settings", "label": "Loan Settings", "fieldtype": "Section Break", - "insert_after": "exception_budget_approver_role", + "insert_after": "loan_tab", }, { "fieldname": "loan_restructure_limit", diff --git a/lending/patches.txt b/lending/patches.txt index 1166f3df..81755909 100644 --- a/lending/patches.txt +++ b/lending/patches.txt @@ -9,4 +9,5 @@ lending.patches.v15_0.rename_process_asset_classification_doctype lending.patches.v15_0.update_loan_types lending.patches.v15_0.create_custom_fields #6 lending.patches.v15_0.make_loan_type_non_submittable -lending.patches.v15_0.rename_asset_classification_ranges \ No newline at end of file +lending.patches.v15_0.rename_asset_classification_ranges +lending.patches.v15_0.update_custom_fields_for_company_tab \ No newline at end of file diff --git a/lending/patches/v15_0/update_custom_fields_for_company_tab.py b/lending/patches/v15_0/update_custom_fields_for_company_tab.py new file mode 100644 index 00000000..abcc1f3f --- /dev/null +++ b/lending/patches/v15_0/update_custom_fields_for_company_tab.py @@ -0,0 +1,27 @@ +# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + + +import frappe +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + + +def execute(): + create_custom_fields( + { + "Company": [ + { + "fieldname": "loan_tab", + "fieldtype": "Tab Break", + "label": "Loan", + "insert_after": "expenses_included_in_valuation", + }, + ] + }, + ignore_validate=True, + ) + + if frappe.db.exists("Custom Field", {"name": "Company-loan_settings"}): + frappe.db.set_value( + "Custom Field", {"name": "Company-loan_settings"}, "insert_after", "loan_tab" + )