We are developing an Android app which tracks vehicles across different warehouses. We basically need a Move sheet which lets us know where (which warehouse) each vehicle needs to be transferred to on a given day and this will help us track the vehicle. This Move sheet is a CSV file containing some details like Serial number, target warehouse, date required on. I need to generate this from ERPNext. My android app reads this Move sheet and lets the user know what vehicles have to transferred out on that day. I have been trying to find a way to do this and so far I have come up empty. I have a couple of questions which I think will help me find a solution.
1.Is there a white listed API method available for me to use to generate this kind of a CSV file ? I am thinking the Stock Ledger report should be the one to give me the vehicle details. I know I can export this data via the desktop app, is there a way for me to use an API to generate this CSV file and invoke this API from my android app?
- My other option is to generate this CSV file using a custom client side script and save this on to a file server every night and then use the Android app to download this file on to mobile device and do something on the mobile device. How can I, in this scenario save the CSV file onto a file server from where my app can fetch this file?
Any pointers or suggestions are most welcome!
PS: I tried looking for a discussion on a similar topic but the results were not helpful.
Why CSV? You can directly get a JSON object with the required data. A simple whitelisted method should do it. Where are you stuck?
Ok, I thought about that but the client requirements stated that I use a Move sheet (which is a CSV file) to compare data. Maybe I need to improvise. So are you saying that I can simply use an API (in my case a REST API) method to query the Stock Ledger Entry table and display the results to the user? In that case I wont need to generate a Move sheet kind of thing at all. Am I correct in my understanding?
As to where I am stuck… What i want is something similar to the Stock Ledger report that is generated on the desktop erpnext app. Is there an API to help me generate that report through my app? A JSON object will be the ideal thing!
As per my understanding, the stock ledger report is nothing but the result of some queries to the Stock ledger entry table. Am I correct?
@Pragnya: you may want to review Web API Call for Report Print in HTML where @rmehta explains how to capture requests and JSON output for a custom report and then wrap such a request into your third-party app.
Another alternative is to customize your ERPNext instace where Android App is assumed to read Stock Ledger report data from. You may build a new custom function (inside a new custom app you develop) to return JSON with data from Stock Ledger report and then expose it for RPC calls (whitelist, in Frappe/ERPNext lingua franca) from external apps as explained in https://frappe.github.io/frappe/user/en/guides/integration/rest_api, RPC section.