Skip to content

ffl_core.api.cost_correction

Source: apps/ffl_core/ffl_core/api/cost_correction.py · 2 endpoint(s)

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

correct_serial_cost

POST /api/method/ffl_core.api.cost_correction.correct_serial_cost

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

Correct the acquisition cost of one in-stock, owned firearm serial.

Books a Stock Reconciliation at today's date (the discovery period). A pay-on-sale gun whose cost is still parked in SRBNB routes the delta to SRBNB instead of Stock Adjustment, keeping the supplier liability consistent (PS-7).

arg type required default description
serial string yes — Serial No name — must be an Active firearm the store OWNS (is_consignment=0). Its warehouse does not matter: a gun out on consignment at a dealer is still ours and is correctable.
new_cost — yes — New acquisition cost, strictly > 0 (rounded to 2dp).
reason string yes — Required free-text audit reason.
payout_was_different — no 0 1 when the amount actually paid to the seller was different (the gun's seller payment was recorded in the cash drawer, on its own or with its Receive Goods receipt): the difference is then booked against the same cash or bank account. Default 0: only the cost changes and no cash moves.

Returns: {ok, serial, stock_reconciliation, old_cost, new_cost, delta, posting_date, payout_adjustment, payout_note, source_of_cost_hint}; payout_adjustment is the Journal Entry that books the difference when the seller's payment for this gun was recorded in the cash drawer, else None; payout_note says why nothing was booked when the box was ticked.

Raises: PermissionError: Non-manager caller. ValidationError: Every rejected input — always with zero partial writes.

Permissions: Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/cost_correction.py:87

list_item_serials_for_cost

POST /api/method/ffl_core.api.cost_correction.list_item_serials_for_cost

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

In-stock, owned serials of a firearm Item, for the correction dialog.

Read-only. Excludes sold/inactive serials and guns consigned TO us (is_consignment=1) — mirrored on the picker. Guns of OURS that are out on consignment at a dealer ARE listed: they stay correctable, and a picker that hid them would rebuild the dead end the server guard just dropped.

arg type required default description
item_code string yes — Firearm Item code; a non-firearm returns an empty list with is_firearm=False rather than erroring.

Returns: {item_code, is_firearm, serials: [{serial, warehouse, purchase_rate, valuation, cash_payout, goods_payout}]}; cash_payout says the seller's payment for the gun was recorded in the cash drawer -- on its own, or with the Receive Goods receipt it came in on (goods_payout names that receipt's payment, else null).

Permissions: Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/cost_correction.py:337