ffl_integrations.distributor.receive_bridge¶
Source: apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py · 7 endpoint(s)
Generated by
make api-docs— do not edit by hand.
build_receive_payload¶
POST /api/method/ffl_integrations.distributor.receive_bridge.build_receive_payload
Auth (derived from code): Roles: Stock Manager / System Manager
Pre-fill the Receive Goods page from a Distributor Order (read-only).
DIVERGENCE-3: reads the DO, enriches lines from their Item, computes this batch's receivable increment, and guards firearm serial counts — but does NOT submit anything.
| arg | type | required | default | description |
|---|---|---|---|---|
do_name |
string | yes | — | Distributor Order name. |
Returns: A create_receive-shaped payload pre-filled from the DO.
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:470
list_incoming¶
POST /api/method/ffl_integrations.distributor.receive_bridge.list_incoming
Auth (derived from code): Roles: Stock Manager / System Manager
Every store-bound Distributor Order with units still outstanding, grouped
by the customer order it serves (restock last), for the Receive Goods "Incoming shipments" panel.
Each order carries what the house said it is sending, what we booked, the
tracking numbers the poll saw, and its lines with per-line outstanding units
and the serials the house echoed — enough to load a whole customer order or
one parcel into the receive session and tick units off as they are scanned.
Restock also lists the outside-POS store invoices (a parcel ordered off-system:
do_name blank, invoice_name set, lines empty until stage_invoice).
Returns: {groups: [{source_doctype, source_name, customer_name, label, orders: [{do_name, invoice_name, invoice_number, outside_pos, distributor, supplier, customer_name, status, hold_status, web_ref, placed_at, source_doctype, source_name, tracking_numbers, expected, received, outstanding, lines: [{line_name, item_code, item_name, sku, is_firearm, outstanding, unit_cost, serials}]}]}]}.
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:399
match_incoming¶
POST /api/method/ffl_integrations.distributor.receive_bridge.match_incoming
Auth (derived from code): Roles: Stock Manager / System Manager
Open store-bound Distributor Order lines a scanned unit of this item could
belong to, earliest order first.
The Receive Goods page asks this on every UPC scan: one candidate opens the
"hold it for this order?" prompt, several list them, none means plain
restock. Only lines with units still outstanding (outstanding_qty) are
returned, so a line already received or covered from shelf stock never
claims a parcel.
| arg | type | required | default | description |
|---|---|---|---|---|
item_code |
string | yes | — | Item code the barcode resolved to. |
Returns: {item_code, candidates: [{do_name, line_name, distributor, supplier, order_type, source_doctype, source_name, customer_name, outstanding, unit_cost, serials, package_index, placed_at}]}.
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:355
receive_from_do¶
POST /api/method/ffl_integrations.distributor.receive_bridge.receive_from_do
Auth (derived from code): Roles: Stock Manager / System Manager
Receive a Distributor Order: create + submit the Purchase Receipt.
Staff action from the pre-filled Receive Goods page: creates + submits
the Purchase Receipt (fires the FastBound acquisition push — with the
DO stamped onto each acquisition BEFORE the push via the payload's
distributor_order key, M2), bumps received_qty per line on the DO,
advances receive_status, and idempotently backstops the
DO→acquisition link.
| arg | type | required | default | description |
|---|---|---|---|---|
do_name |
string | yes | — | Distributor Order name. |
payload |
— | no | None |
Optional edited create_receive payload; defaults to the freshly built pre-fill — dict or JSON string. |
Returns: The receive result (Purchase Receipt name + updated DO state).
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:493
receive_invoice_lines¶
POST /api/method/ffl_integrations.distributor.receive_bridge.receive_invoice_lines
Auth (derived from code): Roles: Stock Manager / System Manager
Receive units of an outside-POS store invoice into stock and the A&D book —
receive_lines for a parcel that has no Distributor Order.
The Receive Goods page submits one call per staged invoice. Each item names the invoice line, the units and (for a firearm) the serial(s) read off the gun. Cost is the invoiced unit cost unless the receiver changed it; a $0 line must say why, exactly as on the page. A line cannot be received beyond its invoiced quantity less what earlier receives booked, and the invoice is marked received when every line is in. Booked against the Distributor's Supplier, Purchase, source = the house; the receipt's remarks name the invoice. Refused for an invoice that already shipped elsewhere, was received, that a POS order now claims, or that looks like the parcel of an open POS order.
| arg | type | required | default | description |
|---|---|---|---|---|
invoice_name |
string | yes | — | Distributor Invoice name. |
items |
— | yes | — | [{line_name, qty, serials?, rate?, manufacturer?, model_name?, firearm_type?, caliber?, importer?, service_need?, sell_price?, is_antique?, year_made?, zero_cost_*?}] — list or JSON string. |
warehouse |
string | null | no | None |
Optional target warehouse (defaults like create_receive). |
Returns: create_receive's result ({ok, name, total}) plus invoice_name and received (True once every line is booked).
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:938
receive_lines¶
POST /api/method/ffl_integrations.distributor.receive_bridge.receive_lines
Auth (derived from code): Roles: Stock Manager / System Manager
Receive SOME units of a Distributor Order — the ones a receiver just
scanned — into stock and the A&D book, and hold them for the waiting order.
The scan-first Receive Goods page submits one call per order it touched.
Each item names the order line, the units, and (for a firearm) the serial(s)
the receiver read off the gun — the distributor's echoed serial is a hint on
screen, never what gets booked. Cost is the line's invoiced unit cost when the
poll has it, else the order-line cost; a $0 line must say why, exactly as on
the page. Over-receiving a line (more than outstanding_qty) is refused.
| arg | type | required | default | description |
|---|---|---|---|---|
do_name |
string | yes | — | Distributor Order name. |
items |
— | yes | — | [{line_name, qty, serials?, rate?, manufacturer?, model_name?, firearm_type?, caliber?, importer?, service_need?, zero_cost_*?}] — list or JSON string. |
warehouse |
string | null | no | None |
Optional target warehouse (defaults like create_receive). |
Returns: create_receive's result ({ok, name, total}) plus do_name.
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:575
stage_invoice¶
POST /api/method/ffl_integrations.distributor.receive_bridge.stage_invoice
Auth (derived from code): Roles: Stock Manager / System Manager
Lay an outside-POS store invoice out for the Receive Goods page: each line's
local Item (found in the house's catalog by SKU, else UPC, and created through the catalog promoter when the shop has none; an existing local Item when the catalog has no row), the units still to book, the invoiced unit cost and — for a firearm — the serials the distributor sent that are not in the books yet.
| arg | type | required | default | description |
|---|---|---|---|---|
invoice_name |
string | yes | — | Distributor Invoice name. |
Returns: {invoice_name, invoice_number, distributor, unmatched: [{sku, reason}], lines: [{line_name, item_code, item_name, sku, is_firearm, has_serial_no, outstanding, unit_cost, serials, manufacturer, model_name, firearm_type, caliber}], received} — unmatched lists lines no Item could be found or made for (left off lines; receive those as plain stock). received: true when the only units left were $0 unmatched lines (a promo freebie), so the invoice was closed here.
Permissions: Receive roles.
apps/ffl_integrations/ffl_integrations/distributor/receive_bridge.py:870