iVendNextDevelopers Request a sandbox

Recipe: reading the shop's own reports

What it is for. Your service needs a figure the shop already has a report for: stock by store, a stock balance over a period, sales by item. You run the shop's own report, with its filters, and read its rows, rather than rebuilding it from records. The shop's report stays the one source of the figure. From iVendNext POS build 2.0.0.654.

The short version.


Technical notes

1. Run a report

POST /api/method/ivendnext_mpos.api.v1.run_report
  {"report_name": "Total Stock Summary", "filters": {"company": "Demo Retail", "group_by": "Warehouse"}}

The answer's message holds columns and result (the rows). The filters are the report's own, as its filter bar in Desk names them; a required filter left out is refused in the report's words. A report the shop has switched off is refused (Report … is disabled). Every HTTP method is accepted.

2. A prepared report

POST /api/method/ivendnext_mpos.api.v1.run_report
  {"report_name": "Stock Balance", "filters": {"company": "Demo Retail", "from_date": "2026-01-01", "to_date": "2026-10-21"}}
→ {"message": {"prepared_report": true, "doc": null, ...}}            # no finished run for these filters yet

POST /api/method/ivendnext_mpos.api.v1.prepare_report
  {"report_name": "Stock Balance", "filters": { …the same… }}
→ {"message": {"name": "<the run's record name>"}}                     # one new run on each call

GET /api/resource/Prepared Report/<the run's record name>             # poll until status is Completed (or Error)

POST /api/method/ivendnext_mpos.api.v1.run_report  { …the same as the first call… }
→ {"message": {"prepared_report": true, "doc": {"name": "<the run>", ...}, "columns": [...], "result": [...]}}

3. Rights, plainly

Call What it checks What it does not
run_report the caller's right to the report's record type; the filters the user may use ⚠ a user named in the call: the report is read as that user (their filters and their User Permissions)
run_report with prepared_report_name the right to run the report named in the call ⚠ that the run belongs to that report or to the caller: a named run is read whole
prepare_report nothing ⚠ any signed-in user may queue any report and read its output, filtered by their own User Permissions

These are the shop's own behaviours, exposed under iVendNext names; the names add no power of their own. A report's own code may check more, as the caller.

What was proven where

Needs this serves

This page in the kit