ffl_core.api.storage¶
Source: apps/ffl_core/ffl_core/api/storage.py · 20 endpoint(s)
Generated by
make api-docs— do not edit by hand.
add_positions¶
POST /api/method/ffl_core.api.storage.add_positions
Auth (derived from code): Roles: Stock Manager / System Manager
Add slots to the end of a Slots zone (existing ones are never renumbered). An Open zone
is one location, so this is refused for it.
| arg | type | required | default | description |
|---|---|---|---|---|
zone |
string | yes | — | The Storage Zone name. |
count |
integer | yes | — | How many to add. |
Returns: {zone, positions, added}.
apps/ffl_core/ffl_core/api/storage.py:492
confirm_taken¶
POST /api/method/ffl_core.api.storage.confirm_taken
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Resolve a "to confirm" item: say which location sold or shipped units really
came from. They leave that location; stock and the books are untouched.
| arg | type | required | default | description |
|---|---|---|---|---|
item_code |
string | yes | — | The non-serialized item. |
location |
string | yes | — | The location they were taken from. |
qty |
number | yes | — | How many. |
company |
string | null | no | None |
Company; defaults to the user's company. |
Returns: {ok: True, move, over}, where over is how many are still to confirm.
apps/ffl_core/ffl_core/api/storage.py:415
create_floor_plan¶
POST /api/method/ffl_core.api.storage.create_floor_plan
Auth (derived from code): Roles: Stock Manager / System Manager
Start an empty floor plan for one room or floor of the store.
| arg | type | required | default | description |
|---|---|---|---|---|
plan_name |
string | yes | — | Name shown on the plan's tab, like Showroom or Back Room. |
width |
number | no | 60 |
Width of the room in feet. |
height |
number | no | 40 |
Depth of the room in feet. |
company |
string | null | no | None |
Company; defaults to the user's company. |
Returns: {plan, modified}.
apps/ffl_core/ffl_core/api/storage.py:561
create_zone¶
POST /api/method/ffl_core.api.storage.create_zone
Auth (derived from code): Roles: Stock Manager / System Manager
Create a zone and its positions. A Slots zone names them A1, A2, ... (one firearm
each). An Open zone is ONE location named like the zone (Rack 1: no limit, holds firearms and everything else); create one zone per rack, case or safe.
| arg | type | required | default | description |
|---|---|---|---|---|
zone_name |
string | yes | — | Short name, like A or Display Case. |
kind |
string | yes | — | Slots or Open. |
count |
integer | no | 1 |
How many slots to create in a Slots zone (ignored for Open, which is one location). |
company |
string | null | no | None |
Company; defaults to the user's company. |
sides |
integer | no | 0 |
Slots only: how many sides (lines of slots) it has on the map, 1-50; a two-sided rack is 2. 0 (default) fits them to the shape it is drawn as. |
numbering |
string | null | no | None |
Slots with two sides: "Odd / even" (default: 1, 3, 5 ... down one side, 2, 4, 6 ... facing them) or "In order" (1, 2, 3 ... down the first side, then the second). One side or three and more always count in order. |
Returns: {zone, positions}.
apps/ffl_core/ffl_core/api/storage.py:448
delete_floor_plan¶
POST /api/method/ffl_core.api.storage.delete_floor_plan
Auth (derived from code): Roles: Stock Manager / System Manager
Delete a floor plan. Its zones stay as they are, just on no plan.
| arg | type | required | default | description |
|---|---|---|---|---|
plan |
string | yes | — | The Storage Floor Plan name. |
company |
string | null | no | None |
The plan's company; defaults to the user's company. |
Returns: {plan}.
apps/ffl_core/ffl_core/api/storage.py:607
delete_zone¶
POST /api/method/ffl_core.api.storage.delete_zone
Auth (derived from code): Roles: Stock Manager / System Manager
Delete a zone and all its positions, and take it off its floor plan. Everything in
it must be moved out first.
| arg | type | required | default | description |
|---|---|---|---|---|
zone |
string | yes | — | The Storage Zone name. |
company |
string | null | no | None |
The zone's company; defaults to the user's company. |
Returns: {zone, removed}.
apps/ffl_core/ffl_core/api/storage.py:524
get_location¶
POST /api/method/ffl_core.api.storage.get_location
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
What is in one location.
| arg | type | required | default | description |
|---|---|---|---|---|
location |
string | yes | — | A Storage Location name (or its barcode, which is the same). |
Returns: {location: {name, label, zone, kind, disabled}, guns: [{serial, item_code, item_name, manufacturer, model_name, caliber}], items: [{item_code, item_name, qty}]}.
apps/ffl_core/ffl_core/api/storage.py:213
get_map¶
POST /api/method/ffl_core.api.storage.get_map
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
The store map: every zone with each position's contents.
| arg | type | required | default | description |
|---|---|---|---|---|
company |
string | null | no | None |
Company to show; defaults to the user's company. |
Returns: {company, zones: [{name, zone_name, kind, disabled, slot_lines, numbering, positions, used, locations: [{name, label, position, disabled, guns: [{serial, item_name}], qty, items}]}], plans: [{name, plan_name, width, height, modified, layout: {shapes: [{type, zone?, text?, x, y, w, h, r, rows?}]}}], unassigned: {guns, items, to_confirm}}. used counts positions holding a gun (Slots) or anything (Open, which has one). plans are the floor plans (one per room, in feet; x/y is a shape's centre, r its rotation in degrees); every zone shape names a zone in zones.
apps/ffl_core/ffl_core/api/storage.py:157
get_options¶
POST /api/method/ffl_core.api.storage.get_options
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
What the Storage Locations page needs to start: the company, its zones and
whether the user may create or disable them.
| arg | type | required | default | description |
|---|---|---|---|---|
company |
string | null | no | None |
Company to show; defaults to the user's company. |
Returns: {company, can_manage, zones: [{name, zone_name, kind, disabled, positions}]}.
apps/ffl_core/ffl_core/api/storage.py:42
get_unassigned¶
POST /api/method/ffl_core.api.storage.get_unassigned
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Everything not in a location yet, and everything the locations over-claim.
| arg | type | required | default | description |
|---|---|---|---|---|
company |
string | null | no | None |
Company; defaults to the user's company. |
Returns: {guns: [{serial, item_code, item_name, ...}], items: [{item_code, item_name, stock, located, unassigned}], to_confirm: [{item_code, item_name, stock, located, over}]}. to_confirm lists items sold or shipped without saying which location they came from.
apps/ffl_core/ffl_core/api/storage.py:259
list_locations¶
POST /api/method/ffl_core.api.storage.list_locations
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Every location, for pickers and the label printer.
| arg | type | required | default | description |
|---|---|---|---|---|
company |
string | null | no | None |
Company to list; defaults to the user's company. |
include_disabled |
integer | no | 0 |
1 to include disabled locations. |
Returns: [{name, label, zone, kind, position, disabled, free}] in zone and position order. free is true for a Slots position with no firearm in it (always true for an Open position).
apps/ffl_core/ffl_core/api/storage.py:62
location_query¶
POST /api/method/ffl_core.api.storage.location_query
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Link-field search for Storage Location: enabled locations of the user's company,
best match first, with a Slots position already holding a gun marked as taken.
| arg | type | required | default | description |
|---|---|---|---|---|
doctype |
— | yes | — | Always Storage Location (set by the Link control). |
txt |
— | yes | — | What the user typed. |
searchfield |
— | yes | — | Unused; the label and the name (barcode) are searched. |
start |
— | yes | — | Offset into the result. |
page_len |
— | yes | — | Page size. |
filters |
— | yes | — | Optional {company, only_free, kind}. |
Returns: [(name, description)] for the dropdown.
apps/ffl_core/ffl_core/api/storage.py:95
plan_slots¶
POST /api/method/ffl_core.api.storage.plan_slots
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Which slots each pending receive row will fill, in one call, so a receipt of many
guns never offers the same slot twice.
| arg | type | required | default | description |
|---|---|---|---|---|
rows |
— | yes | — | Rows in receipt order (list or JSON): {key, count, start?} fills start and the next free slots in its zone; {key, count, after?} takes the first free slots after after (the suggestion for the next row). Open locations take none. |
Returns: {key: [location names]}; an empty list for an Open location or a taken start slot.
apps/ffl_core/ffl_core/api/storage.py:137
remove_positions¶
POST /api/method/ffl_core.api.storage.remove_positions
Auth (derived from code): Roles: Stock Manager / System Manager
Delete the last slots of a Slots zone (A30, A29, ...). They must be empty, and the
zone keeps at least one -- delete the zone to remove them all.
| arg | type | required | default | description |
|---|---|---|---|---|
zone |
string | yes | — | The Storage Zone name. |
count |
integer | yes | — | How many to delete from the end. |
Returns: {zone, positions, removed}.
apps/ffl_core/ffl_core/api/storage.py:508
save_floor_plan¶
POST /api/method/ffl_core.api.storage.save_floor_plan
Auth (derived from code): Roles: Stock Manager / System Manager
Save a floor plan drawn on the Storage Locations page: its name, size and every
shape on it. Refused if someone else saved the plan after modified.
| arg | type | required | default | description |
|---|---|---|---|---|
plan |
string | yes | — | The Storage Floor Plan name. |
plan_name |
string | yes | — | Name shown on the plan's tab. |
width |
number | yes | — | Width of the room in feet. |
height |
number | yes | — | Depth of the room in feet. |
shapes |
list | str | yes | — |
modified |
string | yes | — | The plan's modified when the editor loaded it. |
company |
string | null | no | None |
The plan's company; defaults to the user's company. |
Returns: {plan, modified, shapes, dropped}. dropped lists zones left out because they were deleted meanwhile.
apps/ffl_core/ffl_core/api/storage.py:579
scan_move¶
POST /api/method/ffl_core.api.storage.scan_move
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Put what was scanned into a location: a firearm by serial number, or units of
a non-serialized item by barcode. Nothing here touches stock or the books.
A quantity comes from from_location if given, else from the units that are in
no location, else from the one other location that holds it. When it could come
from several, nothing moves and options lists them so the page can ask.
| arg | type | required | default | description |
|---|---|---|---|---|
to_location |
string | yes | — | Where it goes (a Storage Location name). |
code |
string | yes | — | A serial number, UPC, or item code. |
qty |
number | no | 1 |
Units for a non-serialized item (a scan adds 1). |
from_location |
string | null | no | None |
Where the units are taken from, when they are in a location. |
Returns: {result: serial | item | already | choose | error, message, serial, item_code, item_name, qty, to_location, from_location, move (the log row, for Undo), options: [{location, label, qty}] (for choose)}. error means nothing moved; the message says why and what to do.
apps/ffl_core/ffl_core/api/storage.py:292
set_disabled¶
POST /api/method/ffl_core.api.storage.set_disabled
Auth (derived from code): Roles: Stock Manager / System Manager
Disable (or re-enable) a zone with all its positions, or one position. A
disabled place takes nothing new. Disabling needs it to be empty.
| arg | type | required | default | description |
|---|---|---|---|---|
disabled |
integer | yes | — | 1 to disable, 0 to enable. |
zone |
string | null | no | None |
The Storage Zone name (give this or location). |
location |
string | null | no | None |
One Storage Location name. |
Returns: {disabled, locations}.
apps/ffl_core/ffl_core/api/storage.py:540
set_zone_layout¶
POST /api/method/ffl_core.api.storage.set_zone_layout
Auth (derived from code): Roles: Stock Manager / System Manager
Change how a Slots zone is drawn on the floor plan. Nothing moves: every slot keeps
its name and what is in it.
| arg | type | required | default | description |
|---|---|---|---|---|
zone |
string | yes | — | The Storage Zone name. |
sides |
integer | no | 0 |
How many sides (lines of slots) it has on the map, 1-50; a two-sided rack is 2. 0 (default) fits them to the shape it is drawn as. |
numbering |
string | null | no | None |
"Odd / even" (default: 1, 3, 5 ... down one side, 2, 4, 6 ... facing them) or "In order"; only two sides are counted odd / even. |
Returns: {zone, sides, numbering}.
apps/ffl_core/ffl_core/api/storage.py:473
stock_locations¶
POST /api/method/ffl_core.api.storage.stock_locations
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
For the pickers on the counter: where each non-serialized item is, so a sale
line can say which location it came from.
| arg | type | required | default | description |
|---|---|---|---|---|
item_codes |
— | yes | — | Item codes (list or JSON list). |
company |
string | null | no | None |
Company; defaults to the user's company. |
Returns: {item_code: {locations: [{location, label, zone, qty}], unassigned, total, sole}}. unassigned is the stock that is in no location; sole is the one location it can only have come from (exactly one holds it and none is unassigned), else null.
apps/ffl_core/ffl_core/api/storage.py:238
undo_move¶
POST /api/method/ffl_core.api.storage.undo_move
Auth (derived from code): Roles: Sales User / Sales Manager / Stock User / Stock Manager / System Manager
Take back a move made on the page: the firearm or units go back where they were.
Only a hand move can be undone, only once, and only while the things are still where that move left them.
| arg | type | required | default | description |
|---|---|---|---|---|
move |
string | yes | — | The Storage Move name returned by scan_move. |
Returns: {ok: True, message} or {ok: False, message} when it can no longer be undone.
apps/ffl_core/ffl_core/api/storage.py:371