def dep_calculation(request): if request.method == 'POST': jsondata = json.loads(request.body.decode('utf-8')) obj = view_fa.FA_Asset_Make() obj.act = jsondata.get('params').get('Action') obj.grp = jsondata.get('params').get('Group') obj.typ = jsondata.get('params').get('Type') obj.sub = jsondata.get('params').get('Sub_Type') obj.entity = jsondata.get('params').get('Employee_Gid') params = { "Action": obj.act, "Group": obj.grp, "Type": obj.typ, "Sub_Type": obj.sub, "Employee_Gid": obj.entity } headers = { "content-type": "application/json", "Authorization": "" + token + "" } datas = json.dumps(jsondata.get('params').get('json')) resp = requests.post("" + ip + "/FA_DEPRECIATION", params=params, data=datas, headers=headers, verify=False) response = resp.content.decode("utf-8") return HttpResponse(response)
def sale_make(request): if request.method == 'POST': jsondata = json.loads(request.body.decode('utf-8')) obj = view_fa.FA_Asset_Make() obj.act = jsondata.get('params').get('Action') obj.grp = jsondata.get('params').get('Group') obj.channel = jsondata.get('params').get('Channel') obj.so_header_date = jsondata.get('params').get('So_Header_date') obj.entity = jsondata.get('params').get('Employee_Gid') params = { "Action": obj.act, "Group": obj.grp, "Employee_Gid": obj.entity, "Channel": obj.channel, "So_Header_date": obj.so_header_date } headers = { "content-type": "application/json", "Authorization": "" + token + "" } datas = json.dumps(jsondata.get('params').get('json')) resp = requests.post("" + ip + "/FA_SALE", params=params, data=datas, headers=headers, verify=False) response = resp.content.decode("utf-8") return HttpResponse(response)