mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
chore: remove all six compat code
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
import frappe
|
||||
from frappe.utils.dashboard import cache_source
|
||||
from six import iteritems
|
||||
|
||||
from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure import (
|
||||
get_loan_security_details,
|
||||
@@ -53,14 +52,14 @@ def get_data(chart_name = None, chart = None, no_cache = None, filters = None, f
|
||||
GROUP BY p.loan_security
|
||||
""".format(conditions=conditions), filters, as_list=1))
|
||||
|
||||
for security, qty in iteritems(pledges):
|
||||
for security, qty in pledges.items():
|
||||
current_pledges.setdefault(security, qty)
|
||||
current_pledges[security] -= unpledges.get(security, 0.0)
|
||||
|
||||
sorted_pledges = dict(sorted(current_pledges.items(), key=lambda item: item[1], reverse=True))
|
||||
|
||||
count = 0
|
||||
for security, qty in iteritems(sorted_pledges):
|
||||
for security, qty in sorted_pledges.items():
|
||||
values.append(qty * loan_security_details.get(security, {}).get('latest_price', 0))
|
||||
labels.append(security)
|
||||
count +=1
|
||||
|
||||
@@ -8,7 +8,6 @@ import math
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import add_months, flt, getdate, now_datetime, nowdate
|
||||
from six import string_types
|
||||
|
||||
import erpnext
|
||||
from erpnext.controllers.accounts_controller import AccountsController
|
||||
@@ -321,7 +320,7 @@ def make_loan_write_off(loan, company=None, posting_date=None, amount=0, as_dict
|
||||
@frappe.whitelist()
|
||||
def unpledge_security(loan=None, loan_security_pledge=None, security_map=None, as_dict=0, save=0, submit=0, approve=0):
|
||||
# if no security_map is passed it will be considered as full unpledge
|
||||
if security_map and isinstance(security_map, string_types):
|
||||
if security_map and isinstance(security_map, str):
|
||||
security_map = json.loads(security_map)
|
||||
|
||||
if loan:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'loan',
|
||||
|
||||
@@ -10,7 +10,6 @@ from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.utils import cint, flt, rounded
|
||||
from six import string_types
|
||||
|
||||
from erpnext.loan_management.doctype.loan.loan import (
|
||||
get_monthly_repayment_amount,
|
||||
@@ -190,7 +189,7 @@ def create_pledge(loan_application, loan=None):
|
||||
#This is a sandbox method to get the proposed pledges
|
||||
@frappe.whitelist()
|
||||
def get_proposed_pledge(securities):
|
||||
if isinstance(securities, string_types):
|
||||
if isinstance(securities, str):
|
||||
securities = json.loads(securities)
|
||||
|
||||
proposed_pledges = {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'loan_application',
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import add_days, cint, date_diff, flt, get_datetime, getdate
|
||||
from six import iteritems
|
||||
|
||||
import erpnext
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
@@ -187,7 +186,7 @@ class LoanRepayment(AccountsController):
|
||||
# interest_paid = self.amount_paid - self.principal_amount_paid - self.penalty_amount
|
||||
|
||||
if interest_paid > 0:
|
||||
for lia, amounts in iteritems(repayment_details.get('pending_accrual_entries', [])):
|
||||
for lia, amounts in repayment_details.get('pending_accrual_entries', []).items():
|
||||
if amounts['interest_amount'] + amounts['payable_principal_amount'] <= interest_paid:
|
||||
interest_amount = amounts['interest_amount']
|
||||
paid_principal = amounts['payable_principal_amount']
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'loan_security',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'loan_security_type',
|
||||
|
||||
@@ -6,7 +6,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import flt, get_datetime, getdate
|
||||
from six import iteritems
|
||||
|
||||
|
||||
class LoanSecurityUnpledge(Document):
|
||||
@@ -109,7 +108,7 @@ class LoanSecurityUnpledge(Document):
|
||||
pledged_qty = 0
|
||||
current_pledges = get_pledged_security_qty(self.loan)
|
||||
|
||||
for security, qty in iteritems(current_pledges):
|
||||
for security, qty in current_pledges.items():
|
||||
pledged_qty += qty
|
||||
|
||||
if not pledged_qty:
|
||||
@@ -142,7 +141,7 @@ def get_pledged_security_qty(loan):
|
||||
GROUP BY p.loan_security
|
||||
""", (loan)))
|
||||
|
||||
for security, qty in iteritems(pledges):
|
||||
for security, qty in pledges.items():
|
||||
current_pledges.setdefault(security, qty)
|
||||
current_pledges[security] -= unpledges.get(security, 0.0)
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'loan_type',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'process_loan_interest_accrual',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'process_loan_security_shortfall',
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from six import iteritems
|
||||
|
||||
import erpnext
|
||||
|
||||
@@ -44,7 +43,7 @@ def get_data(filters):
|
||||
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for key, qty in iteritems(pledge_values):
|
||||
for key, qty in pledge_values.items():
|
||||
if qty:
|
||||
row = {}
|
||||
current_value = flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from six import iteritems
|
||||
|
||||
import erpnext
|
||||
from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure import (
|
||||
@@ -43,7 +42,7 @@ def get_data(filters):
|
||||
current_pledges, total_portfolio_value = get_company_wise_loan_security_details(filters, loan_security_details)
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for security, value in iteritems(current_pledges):
|
||||
for security, value in current_pledges.items():
|
||||
if value.get('qty'):
|
||||
row = {}
|
||||
current_value = flt(value.get('qty', 0) * loan_security_details.get(security, {}).get('latest_price', 0))
|
||||
@@ -70,7 +69,7 @@ def get_company_wise_loan_security_details(filters, loan_security_details):
|
||||
|
||||
total_portfolio_value = 0
|
||||
security_wise_map = {}
|
||||
for key, qty in iteritems(pledge_values):
|
||||
for key, qty in pledge_values.items():
|
||||
security_wise_map.setdefault(key[1], {
|
||||
'qty': 0.0,
|
||||
'applicant_count': 0.0
|
||||
|
||||
Reference in New Issue
Block a user