mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
fix: Remarks fix
This commit is contained in:
@@ -7,7 +7,8 @@ frappe.ui.form.on('Loan', {
|
|||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.make_methods = {
|
frm.make_methods = {
|
||||||
'Loan Disbursement': function() { frm.trigger('make_loan_disbursement') },
|
'Loan Disbursement': function() { frm.trigger('make_loan_disbursement') },
|
||||||
'Loan Security Unpledge': function() { frm.trigger('create_loan_security_unpledge') }
|
'Loan Security Unpledge': function() { frm.trigger('create_loan_security_unpledge') },
|
||||||
|
'Loan Write Off': function() { frm.trigger('make_loan_write_off_entry') }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onload: function (frm) {
|
onload: function (frm) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"section_break_15",
|
"section_break_15",
|
||||||
"process_loan_interest_accrual",
|
"process_loan_interest_accrual",
|
||||||
"repayment_schedule_name",
|
"repayment_schedule_name",
|
||||||
|
"last_accrual_date",
|
||||||
"amended_from"
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@@ -163,13 +164,20 @@
|
|||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Penalty Amount",
|
"label": "Penalty Amount",
|
||||||
"options": "Company:company:default_currency"
|
"options": "Company:company:default_currency"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "last_accrual_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Last Accrual Date",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-10-11 11:17:44.704694",
|
"modified": "2020-11-06 13:22:40.197916",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Loan Management",
|
"module": "Loan Management",
|
||||||
"name": "Loan Interest Accrual",
|
"name": "Loan Interest Accrual",
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ class LoanInterestAccrual(AccountsController):
|
|||||||
if not self.interest_amount and not self.payable_principal_amount:
|
if not self.interest_amount and not self.payable_principal_amount:
|
||||||
frappe.throw(_("Interest Amount or Principal Amount is mandatory"))
|
frappe.throw(_("Interest Amount or Principal Amount is mandatory"))
|
||||||
|
|
||||||
|
if not self.last_accrual_date:
|
||||||
|
self.last_accrual_date = get_last_accrual_date(self.loan)
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.make_gl_entries()
|
self.make_gl_entries()
|
||||||
|
|
||||||
@@ -50,7 +53,7 @@ class LoanInterestAccrual(AccountsController):
|
|||||||
"against_voucher_type": "Loan",
|
"against_voucher_type": "Loan",
|
||||||
"against_voucher": self.loan,
|
"against_voucher": self.loan,
|
||||||
"remarks": _("Interest accrued from {0} to {1} against loan: {2}").format(
|
"remarks": _("Interest accrued from {0} to {1} against loan: {2}").format(
|
||||||
get_last_accural_date(self.loan), self.posting_date, self.loan),
|
self.last_accrual_date, self.posting_date, self.loan),
|
||||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||||
"posting_date": self.posting_date
|
"posting_date": self.posting_date
|
||||||
})
|
})
|
||||||
@@ -67,7 +70,7 @@ class LoanInterestAccrual(AccountsController):
|
|||||||
"against_voucher_type": "Loan",
|
"against_voucher_type": "Loan",
|
||||||
"against_voucher": self.loan,
|
"against_voucher": self.loan,
|
||||||
"remarks": ("Interest accrued from {0} to {1} against loan: {2}").format(
|
"remarks": ("Interest accrued from {0} to {1} against loan: {2}").format(
|
||||||
get_last_accural_date(self.loan), self.posting_date, self.loan),
|
self.last_accrual_date, self.posting_date, self.loan),
|
||||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||||
"posting_date": self.posting_date
|
"posting_date": self.posting_date
|
||||||
})
|
})
|
||||||
@@ -213,13 +216,13 @@ def make_loan_interest_accrual_entry(args):
|
|||||||
|
|
||||||
|
|
||||||
def get_no_of_days_for_interest_accural(loan, posting_date):
|
def get_no_of_days_for_interest_accural(loan, posting_date):
|
||||||
last_interest_accrual_date = get_last_accural_date(loan.name)
|
last_interest_accrual_date = get_last_accrual_date(loan.name)
|
||||||
|
|
||||||
no_of_days = date_diff(posting_date or nowdate(), last_interest_accrual_date) + 1
|
no_of_days = date_diff(posting_date or nowdate(), last_interest_accrual_date) + 1
|
||||||
|
|
||||||
return no_of_days
|
return no_of_days
|
||||||
|
|
||||||
def get_last_accural_date(loan):
|
def get_last_accrual_date(loan):
|
||||||
last_posting_date = frappe.db.sql(""" SELECT MAX(posting_date) from `tabLoan Interest Accrual`
|
last_posting_date = frappe.db.sql(""" SELECT MAX(posting_date) from `tabLoan Interest Accrual`
|
||||||
WHERE loan = %s and docstatus = 1""", (loan))
|
WHERE loan = %s and docstatus = 1""", (loan))
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from erpnext.controllers.accounts_controller import AccountsController
|
|||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import update_shortfall_status
|
from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import update_shortfall_status
|
||||||
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
|
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
|
||||||
from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import get_per_day_interest, get_last_accural_date
|
from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import get_per_day_interest, get_last_accrual_date
|
||||||
|
|
||||||
class LoanRepayment(AccountsController):
|
class LoanRepayment(AccountsController):
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ class LoanRepayment(AccountsController):
|
|||||||
if self.total_interest_paid > self.interest_payable:
|
if self.total_interest_paid > self.interest_payable:
|
||||||
if not self.is_term_loan:
|
if not self.is_term_loan:
|
||||||
# get last loan interest accrual date
|
# get last loan interest accrual date
|
||||||
last_accrual_date = get_last_accural_date(self.against_loan)
|
last_accrual_date = get_last_accrual_date(self.against_loan)
|
||||||
|
|
||||||
# get posting date upto which interest has to be accrued
|
# get posting date upto which interest has to be accrued
|
||||||
per_day_interest = flt(get_per_day_interest(self.pending_principal_amount,
|
per_day_interest = flt(get_per_day_interest(self.pending_principal_amount,
|
||||||
@@ -87,7 +87,6 @@ class LoanRepayment(AccountsController):
|
|||||||
no_of_days = flt(flt(self.total_interest_paid - self.interest_payable,
|
no_of_days = flt(flt(self.total_interest_paid - self.interest_payable,
|
||||||
precision)/per_day_interest, 0) - 1
|
precision)/per_day_interest, 0) - 1
|
||||||
|
|
||||||
|
|
||||||
posting_date = add_days(last_accrual_date, no_of_days)
|
posting_date = add_days(last_accrual_date, no_of_days)
|
||||||
|
|
||||||
# book excess interest paid
|
# book excess interest paid
|
||||||
@@ -368,7 +367,7 @@ def get_amounts(amounts, against_loan, posting_date):
|
|||||||
if due_date:
|
if due_date:
|
||||||
pending_days = date_diff(posting_date, due_date) + 1
|
pending_days = date_diff(posting_date, due_date) + 1
|
||||||
else:
|
else:
|
||||||
last_accrual_date = get_last_accural_date(against_loan_doc.name)
|
last_accrual_date = get_last_accrual_date(against_loan_doc.name)
|
||||||
pending_days = date_diff(posting_date, last_accrual_date) + 1
|
pending_days = date_diff(posting_date, last_accrual_date) + 1
|
||||||
|
|
||||||
if pending_days > 0:
|
if pending_days > 0:
|
||||||
|
|||||||
@@ -52,14 +52,16 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "accrual_type",
|
"fieldname": "accrual_type",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Accrual Type",
|
"label": "Accrual Type",
|
||||||
"options": "Regular\nRepayment\nDisbursement"
|
"options": "Regular\nRepayment\nDisbursement",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-11-06 04:43:56.581670",
|
"modified": "2020-11-06 13:28:51.478909",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Loan Management",
|
"module": "Loan Management",
|
||||||
"name": "Process Loan Interest Accrual",
|
"name": "Process Loan Interest Accrual",
|
||||||
|
|||||||
Reference in New Issue
Block a user