-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: validations for tables in company loan section and collection_…
…offset_sequence_for_settlement_collection (copy #112) (#113) * chore: validations for tables in company loan section and add collection_offset_sequence_for_settlement_collection (#112) (cherry picked from commit 05ab366) # Conflicts: # lending/patches.txt * chore: fix conflicts --------- Co-authored-by: Anand Baburajan <[email protected]>
- Loading branch information
1 parent
1da8ef3
commit cd5c5ad
Showing
7 changed files
with
93 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import frappe | ||
from frappe import _ | ||
|
||
|
||
def validate_loan_tables(doc, method=None): | ||
loan_classification_ranges = [] | ||
for d in doc.loan_classification_ranges: | ||
if d.classification_code not in loan_classification_ranges: | ||
loan_classification_ranges.append(d.classification_code) | ||
else: | ||
frappe.throw( | ||
_("Classification {0} added multiple times").format(frappe.bold(d.classification_code)) | ||
) | ||
|
||
irac_provisioning_configurations = [] | ||
for d in doc.irac_provisioning_configuration: | ||
if (d.classification_code, d.security_type) not in irac_provisioning_configurations: | ||
irac_provisioning_configurations.append((d.classification_code, d.security_type)) | ||
else: | ||
frappe.throw( | ||
_("Classification {0} with security type {1} added multiple times").format( | ||
frappe.bold(d.classification_code), frappe.bold(d.security_type) | ||
) | ||
) |
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
30 changes: 30 additions & 0 deletions
30
...hes/v15_0/create_custom_field_for_collection_offset_sequence_for_settlement_collection.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,30 @@ | ||
# 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": "collection_offset_sequence_for_settlement_collection", | ||
"label": "Collection Offset Sequence for Settlement Collection", | ||
"fieldtype": "Select", | ||
"options": "IP...IP...IP...CCC\nPPP...III...CCC", | ||
"insert_after": "collection_offset_sequence_for_written_off_asset", | ||
}, | ||
] | ||
}, | ||
ignore_validate=True, | ||
) | ||
|
||
frappe.db.set_value( | ||
"Custom Field", | ||
{"name": "Company-loan_section_break_2"}, | ||
"insert_after", | ||
"collection_offset_sequence_for_settlement_collection", | ||
) |
14 changes: 14 additions & 0 deletions
14
lending/patches/v15_0/rename_irac_provisioning_configuration_loan_product.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,14 @@ | ||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors | ||
# License: GNU General Public License v3. See license.txt | ||
|
||
|
||
from frappe.model.utils.rename_field import rename_field | ||
|
||
|
||
def execute(): | ||
try: | ||
rename_field("Loan IRAC Provisioning Configuration", "loan_product", "security_type") | ||
|
||
except Exception as e: | ||
if e.args[0] != 1054: | ||
raise |