fix indent and imports
This commit is contained in:
parent
8434ec09c3
commit
0ed6382ab6
@ -2,14 +2,15 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import erpnext
|
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import nowdate, add_days
|
from frappe.utils import add_days, nowdate
|
||||||
|
|
||||||
|
import erpnext
|
||||||
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
|
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
|
||||||
process_loan_interest_accrual_for_demand_loans,
|
process_loan_interest_accrual_for_demand_loans,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
|
||||||
|
|
||||||
|
|
||||||
class LoanBalanceAdjustment(AccountsController):
|
class LoanBalanceAdjustment(AccountsController):
|
||||||
@ -66,9 +67,7 @@ class LoanBalanceAdjustment(AccountsController):
|
|||||||
elif self.adjustment_type == "Debit Adjustment":
|
elif self.adjustment_type == "Debit Adjustment":
|
||||||
adj_field = "debit_adjustment_amount"
|
adj_field = "debit_adjustment_amount"
|
||||||
|
|
||||||
frappe.db.set_value(
|
frappe.db.set_value("Loan", self.loan, {adj_field: adjustment_amount})
|
||||||
"Loan", self.loan, {adj_field: adjustment_amount}
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_values_on_cancel(self, loan_details):
|
def get_values_on_cancel(self, loan_details):
|
||||||
if self.adjustment_type == "Credit Adjustment":
|
if self.adjustment_type == "Credit Adjustment":
|
||||||
@ -84,10 +83,7 @@ class LoanBalanceAdjustment(AccountsController):
|
|||||||
elif self.adjustment_type == "Debit Adjustment":
|
elif self.adjustment_type == "Debit Adjustment":
|
||||||
adjustment_amount = loan_details.debit_adjustment_amount + self.amount
|
adjustment_amount = loan_details.debit_adjustment_amount + self.amount
|
||||||
|
|
||||||
if (
|
if loan_details.status in ("Disbursed", "Partially Disbursed") and not loan_details.is_term_loan:
|
||||||
loan_details.status in ("Disbursed", "Partially Disbursed")
|
|
||||||
and not loan_details.is_term_loan
|
|
||||||
):
|
|
||||||
process_loan_interest_accrual_for_demand_loans(
|
process_loan_interest_accrual_for_demand_loans(
|
||||||
posting_date=add_days(self.posting_date, -1),
|
posting_date=add_days(self.posting_date, -1),
|
||||||
loan=self.loan,
|
loan=self.loan,
|
||||||
@ -99,9 +95,7 @@ class LoanBalanceAdjustment(AccountsController):
|
|||||||
def make_gl_entries(self, cancel=0, adv_adj=0):
|
def make_gl_entries(self, cancel=0, adv_adj=0):
|
||||||
gle_map = []
|
gle_map = []
|
||||||
loan_account = frappe.db.get_value("Loan", self.loan, "loan_account")
|
loan_account = frappe.db.get_value("Loan", self.loan, "loan_account")
|
||||||
remarks = "{} against loan {}".format(
|
remarks = "{} against loan {}".format(self.adjustment_type.capitalize(), self.loan)
|
||||||
self.adjustment_type.capitalize(), self.loan
|
|
||||||
)
|
|
||||||
if self.reference_number:
|
if self.reference_number:
|
||||||
remarks += "with reference no. {}".format(self.reference_number)
|
remarks += "with reference no. {}".format(self.reference_number)
|
||||||
|
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
# import frappe
|
import frappe
|
||||||
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe.utils import cint, flt, getdate
|
||||||
|
|
||||||
|
import erpnext
|
||||||
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
|
|
||||||
|
|
||||||
class LoanRefund(Document):
|
class LoanRefund(Document):
|
||||||
"""
|
"""
|
||||||
Add refund if total repayment is more than that is owed.
|
Add refund if total repayment is more than that is owed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.set_missing_values()
|
self.set_missing_values()
|
||||||
self.validate_refund_amount()
|
self.validate_refund_amount()
|
||||||
@ -30,10 +37,7 @@ class LoanRefund(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self.refund_amount > excess_amount:
|
if self.refund_amount > excess_amount:
|
||||||
frappe.throw(_(
|
frappe.throw(_("Refund amount cannot be greater than excess amount {}".format(excess_amount)))
|
||||||
"Refund amount cannot be greater than excess amount {}".format(
|
|
||||||
excess_amount
|
|
||||||
)))
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.update_outstanding_amount()
|
self.update_outstanding_amount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user