Skip to content

ffl_core.api.inventory_count

Source: apps/ffl_core/ffl_core/api/inventory_count.py · 12 endpoint(s)

Generated by make api-docs — do not edit by hand.

cancel_count

POST /api/method/ffl_core.api.inventory_count.cancel_count

Auth (derived from code): Roles: Stock Manager / System Manager

Cancel an open count without adjusting anything.

For a wrong start or an abandoned walk-through. The scans are kept for the record.

arg type required default description
count string yes — The Inventory Count name.

Returns: {ok}.

apps/ffl_core/ffl_core/api/inventory_count.py:216

create_count

POST /api/method/ffl_core.api.inventory_count.create_count

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Start a stocktake.

With no warehouses and no item groups it covers the whole store: every warehouse that holds the store's own stock, every item group. Anything outside the scope never shows up as a difference.

arg type required default description
company string | null no None Company to count; defaults to the user's company.
warehouses — no None Warehouse names (list or JSON) to limit the count to; empty = all.
item_groups — no None Item Group names (list or JSON) to limit the count to (children included); empty = all.
include_custody — no 1 1 to count customer-custody warehouses too, 0 to leave them out.
notes string | null no None Optional free text.

Returns: {name, company, warehouses: [name], item_groups: [name]}.

apps/ffl_core/ffl_core/api/inventory_count.py:137

finalize

POST /api/method/ffl_core.api.inventory_count.finalize

Auth (derived from code): Roles: Stock Manager / System Manager

Finalize a count: adjust the non-serialized differences and save the firearm report.

Posts one Stock Reconciliation for the non-serialized differences, dated the moment the figures were worked out, so anything sold afterwards stacks on top of it. Refused, with nothing posted, while a register sale (POS Invoice not yet closed) is open on any row being adjusted: ERPNext takes that stock out only when the register closes, so a quantity set now would be wrong by exactly that much. Firearms are never adjusted here, no disposition is created and FastBound is not called: a missing gun needs a person to look into it. A count with no quantity entries at all (firearms only) finishes without a reconciliation.

arg type required default description
count string yes — The Inventory Count name; must be open and have at least one scan.
item_rows — no None The rows to adjust, as [{item_code, warehouse}] (list or JSON), so staff can untick rows on the page. Left out = every row with a difference EXCEPT items nobody scanned: those are only adjusted (to 0) when listed here. Quantities are always worked out again here, never taken from the caller.

Returns: {ok, stock_reconciliation, adjusted: [{item_code, warehouse, expected, adjust_to}], skipped: [{item_code, item_name, warehouse, counted, reason}], serial: {missing, unexpected, unknown}}.

apps/ffl_core/ffl_core/api/inventory_count.py:1019

get_counts

POST /api/method/ffl_core.api.inventory_count.get_counts

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

The most recent counts, newest first, with how many entries each holds.

Returns: [{name, status, company, creation, owner, finalized_at, stock_reconciliation, entries, warehouses: [name], item_groups: [name]}].

apps/ffl_core/ffl_core/api/inventory_count.py:184

get_item_row

POST /api/method/ffl_core.api.inventory_count.get_item_row

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

One row of the Items list, for an item another device (or a typed entry) just

added that this page has no row for yet — cheaper than reloading the whole state.

arg type required default description
count string yes — The Inventory Count name.
item_code string yes — The item.
warehouse string yes — The warehouse it was counted in.

Returns: {item_code, item_name, item_group, warehouse, expected, upc, counted, last_entry, last_delta}.

apps/ffl_core/ffl_core/api/inventory_count.py:950

get_scope_options

POST /api/method/ffl_core.api.inventory_count.get_scope_options

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

What the New Count dialog can offer: the company and its countable warehouses.

arg type required default description
company string | null no None Company to list warehouses for; defaults to the user's company.

Returns: {company, warehouses: [name], default_warehouse}.

apps/ffl_core/ffl_core/api/inventory_count.py:115

get_state

POST /api/method/ffl_core.api.inventory_count.get_state

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Everything the page shows for one count.

arg type required default description
count string yes — The Inventory Count name.
counts_only — no 0 1 for the light version the page polls every few seconds: only what has been scanned (found guns, counted quantities, unknown barcodes). A cursor ("changes since") cannot show an Undo, so this re-sends the whole folded tally, which is small.

Returns: {status, server_time, found: {serial: {entry, by, at, method, item_code}}, counted: [{item_code, warehouse, counted, last_entry, last_delta}], unknown: [{entry, code, by, at}]} and, unless counts_only, also {company, warehouses, default_warehouse, stock_reconciliation, serials: [expected guns with label], items: [{item_code, item_name, warehouse, upc, expected, counted, last_entry, last_delta}]}.

apps/ffl_core/ffl_core/api/inventory_count.py:910

scan

POST /api/method/ffl_core.api.inventory_count.scan

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Record one scan: a firearm's serial number or an item's barcode.

The code is tried as a serial number first (case and surrounding spaces ignored), then as an item barcode (UPC). A serial adds the gun once; scanning it again changes nothing. A UPC adds 1 to that item in warehouse. A code that matches neither is saved as an unknown barcode so it shows in the report.

arg type required default description
count string yes — The Inventory Count name; must be open.
code string yes — What the scanner typed.
warehouse string | null no None Where a UPC scan is being counted. Optional when the count covers one warehouse or the store's default warehouse is part of it.

Returns: {result: serial|already|item|unknown|error, message, serial, item_code, item_name, warehouse, expected, counted, entry (the row to undo), warning}. result error means nothing was saved (the message says why).

apps/ffl_core/ffl_core/api/inventory_count.py:386

set_qty

POST /api/method/ffl_core.api.inventory_count.set_qty

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Type in the counted quantity for an item, for something with no barcode.

Saved as the difference from what is already counted, so scans from other devices at the same moment are not overwritten.

arg type required default description
count string yes — The Inventory Count name; must be open.
item_code string yes — A non-serialized stock item.
warehouse string yes — The warehouse it was counted in; must be part of the count.
qty — yes — The quantity found, 0 or more.

Returns: {ok, counted, entry, last_entry, last_delta}; entry is null (and nothing changes) when the item was already counted at this quantity.

apps/ffl_core/ffl_core/api/inventory_count.py:424

toggle_serial

POST /api/method/ffl_core.api.inventory_count.toggle_serial

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Tick or untick a gun by hand, for a gun whose label will not scan.

arg type required default description
count string yes — The Inventory Count name; must be open.
serial string yes — The serial number.
found — yes — 1 to mark the gun as counted, 0 to remove its count. Taking away someone else's scan needs a Stock Manager.

Returns: {ok, found, entry}.

apps/ffl_core/ffl_core/api/inventory_count.py:476

undo

POST /api/method/ffl_core.api.inventory_count.undo

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

Remove one scan or typed entry from an open count.

arg type required default description
entry string yes — The Inventory Count Entry name. Already gone counts as done.

Returns: {ok, kind, serial_no, code, item_code, warehouse, counted, last_entry, last_delta}: what the removal leaves behind (for a quantity entry, the item's new counted total and its newest remaining entry). Only the person who made the entry, or a Stock Manager, may remove it.

apps/ffl_core/ffl_core/api/inventory_count.py:509

variance

POST /api/method/ffl_core.api.inventory_count.variance

Auth (derived from code): Roles: Stock User / Stock Manager / System Manager

The difference between what was counted and what the system says.

Non-serialized rows are what finalize would adjust. Firearms are only ever listed. A finalized count returns the report saved when it was finalized.

arg type required default description
count string yes — The Inventory Count name.

Returns: {status, stock_reconciliation, serial: {missing, unexpected, unknown}, items: [{item_code, item_name, warehouse, expected, counted, moved, adjust_to, difference, never_scanned, open_register_sales: [{invoice, posted}]}], skipped: [{item_code, item_name, warehouse, counted, reason}], quantity_counted, entries}. moved is what sold or arrived since the item was counted. skipped items cannot be reconciled (adjust them by hand). open_register_sales lists POS sales not yet closed: a row with any cannot be adjusted (finalize refuses) until the register closes. quantity_counted is false for a firearms-only count, which finishes with the firearm report alone.

apps/ffl_core/ffl_core/api/inventory_count.py:977