Skip to content

ffl_integrations.rsr.promote

Source: apps/ffl_integrations/ffl_integrations/rsr/promote.py · 4 endpoint(s)

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

backfill_from_rsr

POST /api/method/ffl_integrations.rsr.promote.backfill_from_rsr

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

Update RSR-linked Items in place with firearm details that promote_to_item

now writes (manufacturer, model_name, firearm_type, dealer_price, image, image_gallery primary). Skips fields the user has already set non-empty.

arg type required default description
item_codes array | null no None Optional list or comma-separated string — only those Items are touched. Otherwise scans a local-only candidate net — every Item with dropship_distributor set, plus every Item carrying any barcode — and resolves each through _rsr_for_item (remote); non-RSR candidates simply come back None and count as skipped.

Returns: {updated, skipped, total}.

apps/ffl_integrations/ffl_integrations/rsr/promote.py:519

lookup_for_item_form

POST /api/method/ffl_integrations.rsr.promote.lookup_for_item_form

Auth (derived from code): Requires write permission on Item (Frappe DocType permission check).

Resolve a UPC / RSR stock # / mfg # to a field map ready for the Item form.

Used by the client script on the Item form (public/js/item_form.js). Does NOT insert anything — the Item form stays in 'unsaved' state and the user can still tweak fields before save.

arg type required default description
scan string yes — UPC / RSR stock number / manufacturer part number.

Returns: {found: True, defaults: {item_code, item_name, ...}, rsr: {...}} on hit, or {found: False, scan: ...} on miss.

apps/ffl_integrations/ffl_integrations/rsr/promote.py:659

migrate_legacy_item_groups

POST /api/method/ffl_integrations.rsr.promote.migrate_legacy_item_groups

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

One-shot migrator for the Item Group restructure.

Moves Items out of the legacy flat groups ("New Firearm", "Used Firearm", parent "Ammunition") into the type-based leaf groups, and sets is_used from the old group name. Idempotent — safe to re-run.

Returns: {firearm_moved, ammo_moved, total}.

apps/ffl_integrations/ffl_integrations/rsr/promote.py:459

promote_to_item

POST /api/method/ffl_integrations.rsr.promote.promote_to_item

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

Build + insert an Item from an RSR Catalog Item.

arg type required default description
payload — yes — JSON string from JS, or dict from Python:

Returns: {item_code, item_name, item_group, has_serial_no, is_firearm, last_rate, stock_uom, found: True} — same shape as ffl_core.api.receive_goods.lookup_item / create_item.

apps/ffl_integrations/ffl_integrations/rsr/promote.py:256