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

test: fix broken tests #260

Merged
merged 55 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ebf1056
fix: fix test_loan_totals
the-bokya Jan 16, 2025
b313cf4
fix: add party checks for non- receivable/payable accounts
the-bokya Jan 16, 2025
e9335a2
fix: fixed test_disbursal_check_without_shortfall
the-bokya Jan 16, 2025
053950d
fix: add party checks for non- receivable/payable accounts -- again
the-bokya Jan 16, 2025
381e5dc
fix: add party checks for non- receivable/payable accounts -- once ag…
the-bokya Jan 17, 2025
56c9dbe
fix: upsert for create_loan_accounts and fix create_repayment_entry
the-bokya Jan 20, 2025
b7c07bb
fix: redo chart of accounts
the-bokya Jan 20, 2025
ac0ecec
fix: chart of accounts
the-bokya Jan 21, 2025
5eefea8
WIP fix demand loans
the-bokya Jan 22, 2025
22dc979
fix: check_sanctioned_amount_limit. repaid interest taken from loan r…
the-bokya Jan 22, 2025
f7929f6
fix: test_principal_amount_paid was calculated for Actual/Actual and …
the-bokya Jan 22, 2025
30756f9
fix: temporary fix for test_pending_loan_amount_after_closure_request
the-bokya Jan 22, 2025
c66a078
fix: fix test_partial_unaccrued_interest_payment
the-bokya Jan 22, 2025
0109dd4
fix: fix test_npa_loan
the-bokya Jan 22, 2025
bdebaf4
fix: fix test_npa_for_loc
the-bokya Jan 22, 2025
865ab1e
fix: fix test_loan_write_off_entry - add interest_waiver_account as a…
the-bokya Jan 22, 2025
4636100
fix: fix loan closures by subtracting excess_amount_paid. Fixes test_…
the-bokya Jan 23, 2025
8411179
fix: fix test_full_settlement
the-bokya Jan 23, 2025
f587d19
fix: fix allocation of loan according to loan offset order
the-bokya Jan 24, 2025
cf1ce09
feat: fix add loan offset order to individual loan products with comp…
the-bokya Jan 27, 2025
73b9b52
fix: add fixed date for test_loan_with_fixed_amount_per_period so tha…
the-bokya Jan 27, 2025
10809a1
test: remove old tests
the-bokya Jan 27, 2025
4b1ded8
test: remove old tests for loan interest accrual
the-bokya Jan 27, 2025
967536d
fix: change penalty_charges_rate's definition
the-bokya Jan 28, 2025
14a306a
test: fix test_loan_with_repayment_periods
the-bokya Jan 28, 2025
271847a
test: fix test_penalty
the-bokya Jan 28, 2025
4adcaa9
test: fix test_security_shortfall
the-bokya Jan 28, 2025
f3046e2
test: fix spelling mistake 🥲
the-bokya Jan 29, 2025
1820dea
test: upsert create_loan_product
the-bokya Jan 29, 2025
97f5362
test: add additional interest accounts to create_loan_product
the-bokya Jan 29, 2025
d027b3c
test: fix test_loan_repayment_for_term_loans (nowdate() 🥲)
the-bokya Jan 30, 2025
b1b2ac8
merge lending-uat into test_maxxing
the-bokya Jan 30, 2025
6a806be
fix: remove premature insert for loan_product
the-bokya Feb 4, 2025
38fb00d
fix: correct Disbursement Account name
the-bokya Feb 4, 2025
00df193
feat: get offset order from Loan Product and, if not present there, f…
the-bokya Feb 4, 2025
2e97668
test: fix test_loan_repayment_for_term_loans (nowdate() 🥲)
the-bokya Feb 4, 2025
012a765
chore: clean code
the-bokya Feb 5, 2025
35c3be3
test: fix all tests
the-bokya Feb 6, 2025
0f2a688
Merge branch 'lending-uat' of https://github.com/frappe/lending into …
deepeshgarg007 Feb 6, 2025
2053c6b
fix: just testing out changes to install.sh
the-bokya Feb 6, 2025
881dc7f
fix: see if bench get-app works
the-bokya Feb 6, 2025
8a15229
fix: random linter problems
the-bokya Feb 6, 2025
ef9571c
fix: create_loan_product
the-bokya Feb 6, 2025
56f7917
fix: get loan_accrual_frequency if not present in calculate_accrual_a…
the-bokya Feb 6, 2025
b1180d8
fix: initialise total_payable_amount
the-bokya Feb 6, 2025
247519f
test: add precision check for test_loan_repayment_for_term_loan
the-bokya Feb 6, 2025
6a0ce30
test: all tests pass
the-bokya Feb 6, 2025
7c50643
fix: party validation catches fixed for waiver entries
the-bokya Feb 7, 2025
b586657
fix: undo changes in no_of_days
the-bokya Feb 7, 2025
b2aad7b
test: set a global defaults for testing (default_company, default_cur…
the-bokya Feb 7, 2025
fb18d9b
test: semgrep fixes (partial)
the-bokya Feb 7, 2025
260ccb9
chore: temporarily escape semgreps
the-bokya Feb 7, 2025
8341cda
chore: remove codecov action
the-bokya Feb 7, 2025
5249015
fix: remove unnecessary process_loan_interest_accrual
the-bokya Feb 7, 2025
f86b048
fix: remove unnecessary catches for ERPNext party/party_type validati…
the-bokya Feb 7, 2025
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
4 changes: 2 additions & 2 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ bench start &> bench_run_logs.txt &
CI=Yes bench build --app frappe &
bench --site test_site reinstall --yes

bench get-app lending "${GITHUB_WORKSPACE}"
bench get-app "${GITHUB_WORKSPACE}"
bench --site test_site install-app lending
bench setup requirements --dev
bench setup requirements --dev
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,3 @@ jobs:
run: cd ~/frappe-bench/ && bench --site test_site run-tests --app lending --coverage
env:
TYPE: server

- name: Upload coverage data
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
files: /home/runner/frappe-bench/sites/coverage.xml
verbose: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*.egg-info
*.swp
tags
node_modules
node_modules
dist
17 changes: 14 additions & 3 deletions lending/loan_management/doctype/loan/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
)


# nosemgrep
class Loan(AccountsController):
def validate(self):
self.set_status()
Expand Down Expand Up @@ -132,6 +133,7 @@ def on_cancel(self):
]
self.set_status()

# nosemgrep
def set_status(self):
if self.docstatus == 0:
self.status = "Draft"
Expand Down Expand Up @@ -362,13 +364,22 @@ def get_total_loan_amount(applicant_type, applicant, company):
],
)

interest_amount = flt(
total_interest_amount = flt(
frappe.db.get_value(
"Loan Interest Accrual",
{"applicant_type": applicant_type, "company": company, "applicant": applicant, "docstatus": 1},
"sum(interest_amount - paid_interest_amount)",
"sum(interest_amount)",
)
)
paid_interest = flt(
frappe.db.get_value(
"Loan Repayment",
{"applicant_type": applicant_type, "company": company, "applicant": applicant, "docstatus": 1},
"sum(total_interest_paid)",
)
)

interest_amount = total_interest_amount - paid_interest

for loan in loan_details:
if loan.status in ("Disbursed", "Loan Closure Requested", "Active"):
Expand Down Expand Up @@ -414,7 +425,7 @@ def request_loan_closure(loan, posting_date=None, auto_close=0):
amounts["pending_principal_amount"]
+ amounts["interest_amount"]
+ amounts["penalty_amount"]
+ amounts.get("excess_amount_paid", 0)
- amounts.get("excess_amount_paid", 0)
)

loan_product, loan_status = frappe.get_value("Loan", loan, ["loan_product", "status"])
Expand Down
Loading
Loading