fix: Utils messsage cleanup

This commit is contained in:
Deepesh Garg 2020-04-27 10:50:40 +05:30
parent 10aff8e118
commit 00ea59b447

View File

@ -372,7 +372,6 @@ def calculate_hra_exemption_for_period(doc):
return exemptions return exemptions
def get_ewb_data(dt, dn): def get_ewb_data(dt, dn):
dn = dn.split(',')
ewaybills = [] ewaybills = []
for doc_name in dn: for doc_name in dn:
@ -453,18 +452,24 @@ def get_ewb_data(dt, dn):
@frappe.whitelist() @frappe.whitelist()
def generate_ewb_json(dt, dn): def generate_ewb_json(dt, dn):
dn = json.loads(dn)
return get_ewb_data(dt, dn)
data = get_ewb_data(dt, dn) @frappe.whitelist()
def download_ewb_json():
data = frappe._dict(frappe.local.form_dict)
frappe.local.response.filecontent = json.dumps(data, indent=4, sort_keys=True) frappe.local.response.filecontent = json.dumps(data['data'], indent=4, sort_keys=True)
frappe.local.response.type = 'download' frappe.local.response.type = 'download'
if len(data['billLists']) > 1: billList = json.loads(data['data'])['billLists']
if len(billList) > 1:
doc_name = 'Bulk' doc_name = 'Bulk'
else: else:
doc_name = dn doc_name = data['docname']
frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(doc_name, frappe.utils.random_string(5)) frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(data['docname'], frappe.utils.random_string(5))
@frappe.whitelist() @frappe.whitelist()
def get_gstins_for_company(company): def get_gstins_for_company(company):