Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Loan API & Fixed: customer_type #134

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions lending/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import frappe

@frappe.whitelist()
def get_loan_list(hub=None,loan_account_number=None,customer_urn=None,customer_name=None):
filters = {}
loan = ''
if hub != None:
filters["hub"] = hub
if loan_account_number != None:
filters["loan_account_number"] = loan_account_number
if customer_name:
customer_name = frappe.db.get_value('Customer',{'customer_name':customer_name},'customer_urn')
if not customer_urn and customer_name:
filters["applicant"] = customer_name
if customer_urn and not customer_name:
filters["applicant"] = customer_urn
if (customer_urn and customer_name) and (customer_urn == customer_name):
filters["applicant"] = customer_urn
if filters != {}:
loan = frappe.db.get_list('Loan',filters = filters, pluck='name')
if (customer_urn and customer_name) and (customer_urn != customer_name):
a = []
loan_urn = frappe.db.get_list('Loan',filters = {'applicant':customer_urn}, pluck='name')
a.extend(loan_urn)
loan_name = frappe.db.get_list('Loan',filters = {'applicant':customer_name}, pluck='name')
a.extend(loan_name)
if loan:
loan.extend(a)
else:
loan = a
return loan
18 changes: 18 additions & 0 deletions lending/fixtures/property_setter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"default_value": null,
"doc_type": "Customer",
"docstatus": 0,
"doctype": "Property Setter",
"doctype_or_field": "DocField",
"field_name": "customer_type",
"is_system_generated": 0,
"modified": "2023-11-20 10:04:12.810886",
"module": null,
"name": "Customer-customer_type-options",
"property": "options",
"property_type": "Text",
"row_name": null,
"value": "Company\nIndividual"
}
]
10 changes: 10 additions & 0 deletions lending/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,13 @@
# auth_hooks = [
# "lending.auth.validate"
# ]

fixtures = [
{"dt": "Property Setter", "filters": [
[
"name", "in", [
"Customer-customer_type-options",
]
]
]}
]