fix: check for string types
This commit is contained in:
parent
a60707873c
commit
9716216632
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe, math, json
|
import frappe, math, json
|
||||||
import erpnext
|
import erpnext
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from six import string_types
|
||||||
from frappe.utils import flt, rounded, add_months, nowdate, getdate, now_datetime
|
from frappe.utils import flt, rounded, add_months, nowdate, getdate, now_datetime
|
||||||
from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
|
from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
@ -282,6 +283,9 @@ def make_loan_write_off(loan, company=None, posting_date=None, amount=0, as_dict
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def unpledge_security(loan=None, loan_security_pledge=None, security_map=None, as_dict=0, save=0, submit=0, approve=0):
|
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 no security_map is passed it will be considered as full unpledge
|
||||||
|
if security_map and isinstance(security_map, string_types):
|
||||||
|
security_map = json.loads(security_map)
|
||||||
|
|
||||||
if loan:
|
if loan:
|
||||||
pledge_qty_map = security_map or get_pledged_security_qty(loan)
|
pledge_qty_map = security_map or get_pledged_security_qty(loan)
|
||||||
loan_doc = frappe.get_doc('Loan', loan)
|
loan_doc = frappe.get_doc('Loan', loan)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user