Skip to content

ffl_core.api.manual_order

Source: apps/ffl_core/ffl_core/api/manual_order.py · 30 endpoint(s)

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

available_serials

POST /api/method/ffl_core.api.manual_order.available_serials

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

In-stock serials (+ sell/cost price) for the Create Order serial picker.

Thin pass-through to the canonical firearm helper.

exclude_unavailable=False: this Create Order picker keeps its existing behaviour (the held/consigned exclusion applies to the THREE POS firearm.py pickers, not this alias). The counter's real gate is _serial_status at scan-to-add / submit, which already rejects a held gun and honours ignore_invoice for the order being edited.

arg type required default description
item_codes — yes — Item code(s) — list, JSON list, or comma-separated.

Returns: {item_code: [{serial, sell_price, cost, ...}]} (see firearm.available_serials_with_prices).

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3915

cancel_order

POST /api/method/ffl_core.api.manual_order.cancel_order

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

Cancel a counter order: cascade documents, refund what was paid.

The Pending Order page's Cancel Order action. The POS document work commits first — cancel the invoice (its own on_cancel hook cascades the FFL/Dealer Transfer dispositions → Material Issue reversal → queued FastBound delete), cancel the linked Sales Order(s), and book a refund Payment Entry for whatever was actually paid (an at-counter inline payment is first restored to its own accounts, since the invoice cancel reversed it) — then a best-effort ShipStation void runs after that commit. Never deletes documents — cancelled records stay as the audit trail. Orders carrying a 4473 disposition are refused.

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice name.
reason string yes — Required free-text cancellation reason.
refund_mode string | null no None Payment mode for the refund entry (required when anything was paid).
refund_reference string | null no None Processor reference (required for Zelle, ACH and Check/Money Order refunds).

Returns: {ok, dispositions_cancelled, delivery_notes_cancelled, sales_orders_cancelled, refund_entry, refunded_amount, shipstation_voided, warning, ...}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3139

check_serials_available

POST /api/method/ffl_core.api.manual_order.check_serials_available

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

Bulk, non-throwing serial validation for draft resume / edit prefill.

Resuming a draft re-checks every parked firearm (drafts don't reserve stock, so a gun may have sold in the meantime).

arg type required default description
serials — yes — List (or JSON-encoded list) of typed serial terms.
ignore_invoice string | null no None Exempts the edited order's own hold — the Edit prefill re-checks the order's own serials, which must not read as unavailable.
customer string | null no None The order's buyer: a gun held for their CRM deal is theirs to buy.

Returns: {typed_term: {ok: True, ...line data} | {ok: False, reason}}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3778

create_order

POST /api/method/ffl_core.api.manual_order.create_order

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

Build a counter order: submitted Sales Order → Sales Invoice.

The Create Order page's single entry point. Handles firearm orders (destination FFL required, optional immediate Dispose & Ship), accessory/direct orders, distributor drop-ship legs, tax exemption, and full or partial payment. Everything runs in one transaction — a failure anywhere rolls the whole order back.

arg type required default description
payload — yes — { buyer_type: "individual" | "business", customer, destination_ffl?, mode_of_payment, payment_received: bool, paid_amount?, shipping_amount?, dispose_now: bool, items: [{item_code, qty, rate, serials: [...], storage_location?}] — storage_location: the in-store location a loose-stock line is taken from (an open location; the units leave it when the stock does, and nothing blocks if it holds less), recipient_name?, recipient_phone?, contact_email?, pickup_in_store?: bool — the customer collects here: no ship-to is stored; drop-ship lines and a destination FFL are refused, and a regulated firearm is allowed only as a ship-to-store line (it is handed over on a POS Invoice, with its 4473, once it arrives), ship_to?: {address_line1, address_line2, city, state, pincode}, notes?, pos_profile?, tax_exempt?, tax_certificate?, draft?, le_excise_exempt?, le_exempt_buyer?, le_exempt_certificate? — a peace officer's (or their agency's) sale: the excise tax comes off, sales tax stays; buyer and CDTFA-230-FET certificate required (compliance.le_excise_exempt), price_approval? — a manager's approval token for prices below list (price_approval.approve; needed while FFL Settings asks for one), crm_deal? — the CRM Deal this order came from: kept on the invoice, which writes back to it (crm.orders); one that no longer exists is dropped and the order goes on } — dict or JSON string. Agreements the buyer has not signed yet (FFL Settings › Used Item Agreement, an Item's required agreement) do not stop the order: each is emailed to the order's email (else the customer's) and Dispose waits for it; a dispose_now order is then held back on Pending Order (ship_held_for_agreements). A failed or impossible email never undoes the order — it is reported.

Returns: {ok, sales_order, sales_invoice, paid_amount, outstanding, disposed, ship_pushed, ship_error, email_to, agreements: [{template, serial_no, state: sent / link_open / failed, email, token_expires, error}], agreement_email_error, ship_held_for_agreements}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:253

delete_order_draft

POST /api/method/ffl_core.api.manual_order.delete_order_draft

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

Delete a Create Order Draft (missing names are ignored).

Also the consumed-draft cleanup create_order calls after success.

arg type required default description
name string yes — Create Order Draft name.

Returns: {"ok": True}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3894

dispose_order

POST /api/method/ffl_core.api.manual_order.dispose_order

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

Dispose (ship) the firearms on a submitted order — the queue action.

Books one transfer disposition per not-yet-disposed serial; the disposition's own on_submit issues the stock-out Material Issue and enqueues the FastBound push. Idempotent. Gated on the pre-ship payment rule (ship_payment_block), a valid destination FFL and the agreements the sale needs: an unsigned one refuses (AgreementRequired) unless override_agreement is 1, which disposes anyway and records who, what was unsigned and why as a comment on the invoice. The signed Each firearm sold copies then belong to this invoice.

arg type required default description
sales_invoice string yes — Submitted Sales Invoice with a destination FFL.
override_agreement integer no 0 1 to dispose although agreements are unsigned.
reason string | null no None Why, for the override's comment (optional).

Returns: {"ok": True, "dispositions": [names], "disposed_count": n, "agreement_override": whether unsigned agreements were overridden}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:1646

find_serial_for_order

POST /api/method/ffl_core.api.manual_order.find_serial_for_order

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

Scan-to-add for the Create Order page: resolve a firearm serial number

straight to an order line (canonical serial + item + tag price). Throws with the specific reason when the gun can't be sold — unknown serial, not in stock, held by a web order, or already on an open counter order. The price comes from the same available_serials_with_prices pass the serial dropdown uses, so both entry paths always quote identically.

arg type required default description
serial string yes — Scanned/typed serial number.
ignore_invoice string | null no None Exempts the edited order's own hold, so staff can delete then re-scan the same gun mid-edit.
customer string | null no None The order's buyer: a gun held for their CRM deal is theirs to buy. Held for anyone else, the refusal is a DealHoldError.

Returns: Order-line data: canonical serial, item_code/item_name, and the tag price.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3746

fulfill_from_stock

POST /api/method/ffl_core.api.manual_order.fulfill_from_stock

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

Serve a ship-to-store line from shelf stock instead of waiting for the

distributor's parcel.

The line becomes an ordinary local leg: its ship-to-store pin is cleared, a gun gets the chosen in-stock serial written on (the counter hold), an accessory keeps its quantity for the Delivery Note leg. The Distributor Order is NOT cancelled (no cancel API at either house): its line's substituted_qty goes up, so the queue stops waiting for it and, when the parcel lands, the Receive Goods scan books it as plain restock instead of holding it for this order. Refused once the goods have arrived (the line already carries its serial), for a serial that is not an unheld, in-stock unit of the item, or for an accessory the shelf cannot cover.

arg type required default description
sales_invoice string yes — The counter order.
row_name string yes — The Sales Invoice Item row.
serial_no string | null no None For a firearm line, the in-stock serial to hold.

Returns: {order, row_name, serial_no, do_name, substituted_qty}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:2445

get_customer_tax_status

POST /api/method/ffl_core.api.manual_order.get_customer_tax_status

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

Tax-exempt flag + certificate URL for a customer.

Lets the Create Order page pre-fill a Business buyer's existing exemption.

arg type required default description
customer string yes — Customer name.

Returns: {"is_tax_exempt": 0|1, "certificate": }.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:5117

get_order_draft

POST /api/method/ffl_core.api.manual_order.get_order_draft

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

Load one Create Order Draft for resume.

arg type required default description
name string yes — Create Order Draft name.

Returns: {"name": ..., "title": ..., "payload": }.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3875

get_order_for_edit

POST /api/method/ffl_core.api.manual_order.get_order_for_edit

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

Reconstruct the create_order payload from an editable pending order.

The Edit flow's prefill. Same shape _collectPayload/save_order_draft use, so the page hydrates it through the existing draft path. tax_exempt is deliberately OMITTED: create_order then falls back to the customer's standing flag, so an edit can never silently re-toggle the exemption.

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice (must pass the editable gate: undisposed, never pushed, no completed pickup).

Returns: {payload: , edit_ctx: {sales_invoice, customer, customer_name, contact_email, grand_total, paid_total, last_payment_mode, carry_block, shipping_tax_inclusive}}. A payload item whose goods are already on order carries ordered_do (that order's name): the page locks the row, and update_order enforces the lock against the orders themselves.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:2672

item_tax_rates

POST /api/method/ffl_core.api.manual_order.item_tax_rates

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

Per-item sales-tax rate for the Create Order preview.

The summed "On Net Total" rate of the company's default sales-tax template as it applies to each item once ERPNext's Item Tax Template resolution (the item's own templates, then its item groups') has overridden the template rows — the same rate compliance.shipping_charge._effective_rate reads off the saved line. A 0% (or Not Applicable) template gives 0, so the preview shows no goods tax on a service-only order and, like the server, no tax on or inside its shipping.

arg type required default description
item_codes — yes — List (or JSON list) of Item codes.
company string | null no None Optional company; defaults to the configured default.
excise_exempt integer no 0 1 for a peace officer's sale — the excise account's rows (compliance.le_excise_exempt) are left out of the rate.

Returns: {: } for every known item.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:5066

list_order_drafts

POST /api/method/ffl_core.api.manual_order.list_order_drafts

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

Shared draft list, newest first — shown in the page's Drafts dialog.

Returns: List of {name, title, customer, total, modified, modified_by}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3858

list_pending_dispositions

POST /api/method/ffl_core.api.manual_order.list_pending_dispositions

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

The Pending Order queue — every submitted counter order that still needs

work: undisposed firearm serials (needs disposing), an outstanding balance (needs payment), or deferred physical stock that hasn't shipped (needs its ShipStation push / Delivery Note leg). FFL shipments and direct orders (no destination FFL — accessories shipping to the buyer, or a counter pickup) both live here; a fully-handled order leaves the queue. A business order shipped on account therefore stays until paid, and a dispose-now order appears (already disposed) until its shipment is pushed.

arg type required default description
customer string | null no None Only this customer's orders. Default: everyone's.

Returns: One card per order: invoice identity/customer/totals, paid state, pending vs disposed serials per item, fulfillment leg state (local/dropship, releasable), ship_to_preview, has_ship_address, shipstation state, and ship_items (when ShipStation is enabled).

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:963

mark_shipped_manually

POST /api/method/ffl_core.api.manual_order.mark_shipped_manually

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

Clear an order from the Pending Order queue without a ShipStation push

— the escape hatch for a destination FFL that expired AFTER dispose, a misconfigured integration, a label bought outside ShipStation, or a direct order handed over at the counter. Books the Delivery Note leg for deferred non-firearm stock lines (stock + COGS), then stamps shipstation_status='Shipped' with no order id (the same convention as the legacy migration stamp), which satisfies the queue's retention rule.

Undisposed firearms no longer refuse — the same as the ShipStation push, which has always been independent of Dispose. This clears the SHIPPING half only: no disposition, no FastBound push, and the gun's stock still leaves through its disposition's Material Issue, so the row stays on the queue with its Dispose button and the caller is warned (warn_undisposed_firearms). The pre-ship payment rule (ship_payment_block — the same gate dispose_order and push_shipment share) still applies: this path really moves the non-firearm goods.

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice name.

Returns: {"ok": True, "delivery_notes": [...], "undisposed_serials": [...]} — undisposed_serials names the firearms whose bound-book entry is still owed. Or {"ok": True, "already": True, "shipstation_status": ...} when already pushed/marked.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:1979

order_agreements

POST /api/method/ffl_core.api.manual_order.order_agreements

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

The agreements a counter order's sale needs and whether the buyer signed —

the Pending Order card's Agreements strip.

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice.

Returns: {"email": where a link goes, "rows": [{template, serial_no, item_code, state (signed / expiring / expired / pending / missing), signed, token_expires, link_open, sent_by}]}.

apps/ffl_core/ffl_core/api/manual_order.py:1733

order_line_costs

POST /api/method/ffl_core.api.manual_order.order_line_costs

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

Unit cost of each Create Order line, for the page's read-only Cost column.

Display only — nothing here feeds create_order or its checks. Each line is costed through the figure the store already keeps for it: a serial → Serial No.purchase_rate (the Sales Report's gun cost); a drop-ship / ship to store line → the Distributor Order line's unit_cost on the order being edited, else that house's catalog quote (the Fulfillment plan's cost); any other store line → its stock valuation, else last purchase rate (the fulfilment-options local cost). A line with no house chosen yet, or a gun without a serial, has no cost to show.

arg type required default description
items — yes — Create Order lines — list or JSON list of {item_code, serials, channel or source, distributor or dropship_distributor, sku}.
sales_invoice string | null no None The order being edited, whose Distributor Orders carry its distributor lines' costs.

Returns: One unit cost per line, in input order — a float, or None when it is not known (never 0).

apps/ffl_core/ffl_core/api/manual_order.py:3941

pending_orders_digest

POST /api/method/ffl_core.api.manual_order.pending_orders_digest

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

Morning summary of stuck counter orders for the managers — every blocked

row and every row older than FFL Settings → pending_order_age_alert_days.

Scheduled daily; sent once per day (a manual re-run the same day is a no-op before the queue is even read); sends nothing when nothing is stuck. Counter rows only (web and GunBroker rows are listed on the page but paid / handled elsewhere).

Returns: {lines: , sent: }.

Permissions: Inventory roles (the scheduler runs as Administrator, whom the gate exempts).

apps/ffl_core/ffl_core/api/manual_order.py:908

quick_create_individual

POST /api/method/ffl_core.api.manual_order.quick_create_individual

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

Create an individual (non-dealer) Customer with a primary Contact.

The Contact carries the receipt email.

arg type required default description
payload — yes — {customer_name (required), email_id (required — receipt destination), phone?} — dict or JSON string.

Returns: {name, customer_name, email_id, phone}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:4067

quote_config

POST /api/method/ffl_core.api.manual_order.quote_config

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

Tax preview config for the Create Order page.

The home state and the default On-Net-Total sales-tax rate, so the page can show the running tax without a round-trip per keystroke. The authoritative tax is still computed server-side at create time from the shipping address.

arg type required default description
company string | null no None Optional company; defaults to the configured default.

Returns: {"home_state": ..., "rate": , "freight_taxable": bool, "shipping_tax_inclusive": bool (a new order's shipping includes its sales tax — FFL Settings), "us_states": {: }, "le_exempt_offered": bool (a California store that names the excise account a peace officer is exempt from), "le_excise_rate": <that account's On Net Total % in the default template>}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:5025

record_payment

POST /api/method/ffl_core.api.manual_order.record_payment

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

Record a later payment against a submitted, not-fully-paid Sales Invoice —

the Pending Order "Record Payment" action for when a customer pays after the order was created on account. Builds and submits a Payment Entry for the full outstanding (or a smaller partial amount), booked to the Mode of Payment's account, and returns the updated balance.

arg type required default description
sales_invoice string yes — Submitted, not-fully-paid Sales Invoice name.
mode_of_payment string yes — Cash, Credit Card, Zelle, ACH or Check/Money Order; Zelle, ACH and Check/Money Order also require transaction_number.
amount — no None Optional partial amount (> 0, at most the outstanding balance); blank pays the full outstanding.
transaction_number — no None Processor reference — the check or money order number for Check/Money Order. Required for Zelle, ACH and Check/Money Order, and for the card tender on a store running the standalone terminal with approval codes required — or with the card processor's terminal live (a card typed in here was run on the Virtual Terminal).
received_on — no None The day the money arrived (blank → today): it dates the Payment Entry, so a collection typed in late still books in the period the deposit really landed in. See _received_on_posting_date for the window.

Returns: {ok, payment_entry, paid_amount, outstanding, paid}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:1455

release_order_legs

POST /api/method/ffl_core.api.manual_order.release_order_legs

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

Release the Draft distributor legs of a counter or web order.

P1 — one-click release: confirms every Draft Distributor Order sourced from the order. The payment rule is the leg's (ffl_integrations.distributor.api.placement_payment_block, applied by confirm_order): a counter drop-ship leg needs the invoice settled, a ship-to-store leg may go out on a deposit or unpaid, and a web order's legs need the Woo order still paid — a leg the rule refuses lands in failed with its reason and stays Draft. Each leg is savepoint-isolated (a failing leg rolls back only its own half-writes, never the siblings or the caller's transaction); confirm/place are idempotent, so a failed leg can be retried. Local/firearm legs keep their own queue buttons.

arg type required default description
sales_invoice string | null no None Counter-order Sales Invoice name.
woo_online_order string | null no None Woo Online Order name, instead of sales_invoice.

Returns: {"released": [DO names], "failed": [{name, error}]}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:1543

rename_customer

POST /api/method/ffl_core.api.manual_order.rename_customer

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

Fix a misspelled customer name SYSTEM-WIDE (the Edit form's pencil):

update customer_name, rename the doc when its id mirrors the name (ERPNext's default customer naming — rename_doc migrates every link), and refresh the display-name snapshot on the customer's open sales documents. Cancelled documents keep their historical spelling on purpose. The primary Contact is NOT renamed (out of scope).

arg type required default description
customer string yes — Customer name (document id).
new_name string yes — Corrected display name.

Returns: {"name": , "customer_name": new_name}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:4120

resend_order_agreement

POST /api/method/ffl_core.api.manual_order.resend_order_agreement

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

Email a counter order's buyer a fresh signing link (the old one stops working).

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice.
template string yes — An agreement this order's sale needs.
serial_no string | null no None The gun, for an Each firearm sold agreement (the link covers every gun of the order still unsigned for it, unless it is signed once per gun).
email string | null no None Send here instead of the order's email (else the customer's).

Returns: {"email", "token_expires"}.

apps/ffl_core/ffl_core/api/manual_order.py:1751

resource_line

POST /api/method/ffl_core.api.manual_order.resource_line

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

Order an unarrived ship-to-store line again from another house.

A Draft Distributor Order is created for the line at the new house (placed from the queue's Place order as usual); the old order's line is retired with substituted_qty so the queue stops waiting on it and its parcel, if it still comes, is restock. The old order is NOT cancelled at the distributor — neither house has a cancel API; the page tells the operator to phone them and quotes the web reference.

arg type required default description
sales_invoice string yes — The counter order.
row_name string yes — The Sales Invoice Item row.
distributor string yes — The house to order from now.

Returns: {order, row_name, do_name: , retired: }.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:2300

save_cr_ffl

POST /api/method/ffl_core.api.manual_order.save_cr_ffl

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

Record a C&R (Type 03) collector's license and return its ATF FFL Record.

verify_ffl cannot serve a collector: the ATF's public FFL list contains no Type 03 licensees at all (that is the whole reason this path exists), so the destination's name, premises and expiry come from a human reading the license copy at the counter. This is that capture for the Create Order page — the same validation the web-order dispose runs (compliance.cr_transfer), so the counter cannot accept what the queue would reject.

The record it upserts is an ordinary destination FFL from here on: the ship-to, the destination-based sales tax and the FFL Transfer disposition all read it the way they read any other.

arg type required default description
cr_details — yes — {license_number, license_expiry, contact_name, premise_street, premise_street2?, premise_city, premise_state, premise_zip} — dict or JSON string.

Returns: {name}: the ATF FFL Record to post back as destination_ffl.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:4016

save_order_draft

POST /api/method/ffl_core.api.manual_order.save_order_draft

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

Park the Create Order page's form state as a shared draft (upsert).

The create_order payload shape plus display extras, stored as a Create Order Draft; upserts when name is passed. The list columns (customer/total/title) are derived here from the same items shape create_order itself consumes. Drafts reserve NOTHING; serials are re-validated on resume.

arg type required default description
payload — yes — create_order-shaped payload (dict or JSON string).
name string | null no None Existing draft name to update; blank creates a new one.
title string | null no None Optional display title; defaults to " · N item(s)".

Returns: {"name": ..., "title": ...}.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3815

set_customer_tax_exempt

POST /api/method/ffl_core.api.manual_order.set_customer_tax_exempt

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

Persist a customer's sales-tax-exempt status (+ optional certificate).

Checking the exemption is enough to exempt; the certificate is optional and, once on file, is attached to the Customer (retrievable any time) and reused.

arg type required default description
customer string yes — Customer name.
exempt — yes — Truthy ("1"/"true"/"yes") to exempt, else cleared.
certificate string | null no None Optional certificate file URL to keep on file.

Returns: {"ok": True, "is_tax_exempt": 0|1, "certificate": }.

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:5141

update_order

POST /api/method/ffl_core.api.manual_order.update_order

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

Edit a pending counter order — the Pending Order page's Edit action.

Cancels the submitted invoice (+ its Sales Orders) and rebuilds it through create_order with the edited payload, in ONE transaction: editing is gated to undisposed, never-pushed orders, so there are no FastBound/ShipStation/ stock side effects, and any failure rolls the whole edit back — the original order survives untouched. Deliberately NO frappe.db.commit() anywhere in this flow.

Money follows the order (_allocate_advances / _rebook_inline_tender); overpay refunds the difference (refund_mode required, Zelle also needs refund_reference — same rules as cancel_order). A changed buyer refunds the FULL paid amount to the ORIGINAL customer and the new invoice starts unpaid — unless carry_payment: then each receipt moves to the new buyer on its own day (the Receive PE is cancelled and amended, the card charge row follows it; inline counter tender re-books dated the sale) and settles the rebuilt invoice; any excess refunds the way it was paid. A carry is all or nothing and refused before any change when a receipt cannot move (_carry_block).

Goods a house is already sending follow the order too: those lines must come back unchanged (same house, lane and quantity — the price may change) and their Distributor Orders are re-pointed at the rebuilt invoice instead of being ordered again. New lines are planned and ordered as usual, so adding an item to an order already placed buys just that item.

arg type required default description
sales_invoice string yes — Submitted counter-order Sales Invoice (editable gate applies).
payload — yes — Edited create_order-shaped payload (dict or JSON string).
refund_mode string | null no None Refund payment mode when the edit produces an overpay.
refund_reference string | null no None Processor reference (required for Zelle, ACH and Check/Money Order refunds).
carry_payment — no 0 1 when the buyer changed and what was paid should settle the rebuilt order under the new buyer instead of being refunded to the old one. Ignored when the buyer is unchanged.

Returns: {ok, sales_invoice: , replaced: , sales_orders_cancelled, grand_total, carried_amount, refund_entry, refunded_amount, outstanding, agreements, agreement_email_error} — the last two as create_order's (a link still open is not sent again).

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3308

verify_ffl

POST /api/method/ffl_core.api.manual_order.verify_ffl

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

Live-verify an FFL number and upsert the ATF FFL Record.

Delegates to the eZ Check integration (online verify + address).

arg type required default description
ffl_number string yes — Full FFL number to verify.

Returns: The eZ Check lookup result (see ffl_integrations.atf.ez_check.lookup_and_create).

Permissions: Sales User / Sales Manager / Stock Manager / System Manager.

apps/ffl_core/ffl_core/api/manual_order.py:3995