Skip to content

ffl_woo_sync.woocommerce.tasks

Source: apps/ffl_woo_sync/ffl_woo_sync/woocommerce/tasks.py · 2 endpoint(s)

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

alert_shipped_undisposed_orders

POST /api/method/ffl_woo_sync.woocommerce.tasks.alert_shipped_undisposed_orders

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Report web orders WooCommerce says shipped while POS still holds them open.

A shipped firearm with no disposition is a missing A&D entry, and nothing surfaced it before — the seven such orders on 2026-08-14 were found by hand.

Reports only; it never disposes anything. Which rifle went in the box is exactly what POS does not know in this state, and guessing it is the mistake the whole serial-handling rework exists to stop.

Returns: {checked, reported} — reported is 0 when the daily throttle suppressed an otherwise non-empty report.

Permissions: Counter roles (manual path; the scheduler runs as Administrator).

apps/ffl_woo_sync/ffl_woo_sync/woocommerce/tasks.py:1655

retry_stuck_serial_reservations

POST /api/method/ffl_woo_sync.woocommerce.tasks.retry_stuck_serial_reservations

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

Re-apply the serial WooCommerce still holds to rows stuck on a STALE

reservation_error.

A rejection is a snapshot of the moment it was written ("that gun is held by WOO-ORD-x"). The only thing that ever retried it was the next order.updated webhook — so when the obstacle cleared (the other order cancelled, or swapped to a different gun) nothing re-ran, and a Woo order that has gone completed sends no further webhook. The row then sat in the Pending Order queue indefinitely, quoting a reason that had stopped being true, and staff had no way to clear it but to re-save the serial on Woo. (2026-08-07: WOO-ORD-01488 was refused C2322, which WOO-ORD-01491 released eight minutes later; only an unrelated update two hours on unstuck it.)

Whitelisted so staff can run it on demand rather than waiting out the cron — which also gives the aged-out orders below a manual way back in.

Bounded on every axis, because this is an unattended writer that calls an external store:

  • LIMIT per run, oldest first;
  • orders older than _RETRY_MAX_AGE_DAYS are reported once and then left alone — a sweep that retries forever is how a permanent failure turns into permanent noise (the lesson _fb_error_is_terminal encodes);
  • out-of-stock rejections are excluded outright: no dealer serial exists on Woo to re-apply, so re-reading that order could never fix it;
  • per-site auto_sync_enabled gate, one Settings read per site.

Returns: A summary dict (retried / cleared / aged-out / skipped counts) so a manual run says what it did.

Permissions: Counter roles (manual path; the scheduler runs as Administrator).

apps/ffl_woo_sync/ffl_woo_sync/woocommerce/tasks.py:1686