-
Notifications
You must be signed in to change notification settings - Fork 189
feat: make loan accounting optional #907
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
base: develop
Are you sure you want to change the base?
feat: make loan accounting optional #907
Conversation
…ual, refund, repayment, write off
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #907 +/- ##
===========================================
+ Coverage 72.34% 72.56% +0.21%
===========================================
Files 128 130 +2
Lines 8828 8886 +58
===========================================
+ Hits 6387 6448 +61
+ Misses 2441 2438 -3
🚀 New features to boost your workflow:
|
Company tab should be "Lending" not "Loan" |
if not self.cost_center: | ||
frappe.throw(_("Cost center is mandatory for loans having rate of interest greater than 0")) | ||
|
||
def set_optional_accounts(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this validation is not needed since we are enforcing it at the Loan Product stage, and we fetch the value from the loan product
self.assertEqual(loan.loan_amount, 1000000) | ||
|
||
def test_loan_disbursement(self): | ||
frappe.db.set_value("Company", "_Test Company", "enable_loan_accounting", 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do this for every test
- Make this a decorator (check for similar settings in other files)
- Enable accounting in the setup since all other tests assume accounting is enabled
- In the specific tests, where we are testing accounting is disabled, disable the setting
flt(repayment.amount_paid - repayment.pending_principal_amount - interest_waiver_amount, 2), | ||
) | ||
|
||
def test_loan_accounting_enabled_or_disabled(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, only enable it for this test
def on_submit(self): | ||
self.set_status_and_amounts() | ||
self.make_gl_entries() | ||
if loan_accounting_enabled(self.company): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting a different idea here.
Make a LoanController class like AccountsController and StockController, and let all doctypes inherit the LoanController (this will be inherited from the accounts controller), then this check can only be done at the LoanController level instead of checking in each doctype.
lending/overrides/journal_entry.py
Outdated
@@ -0,0 +1,9 @@ | |||
from erpnext.accounts.doctype.journal_entry.journal_entry import JournalEntry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
lending/overrides/sales_invoice.py
Outdated
from lending.loan_management.utils import loan_accounting_enabled | ||
|
||
|
||
class CustomSalesInvoice(SalesInvoice): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a new class, and why is it named CustomSalesInvoice
?
@@ -0,0 +1,18 @@ | |||
import frappe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoroughly test this once, as it will have a larger impact once released
…ce and Journal Entry
Details: Frappe Lending Roadmap