scripts.shopify.restore_deleted_products

Recreates the Shopify products update_product deleted because no unit was “A vendre” (between PR #58 and its revert): out-of-stock products must stay listed, at 0 stock.

On the server: make restore-deleted-products (one-off API container, so it reads the production Redis run history and .env).

The deleted Models come from update_product’s run history in Redis (action == "removed", reason == "no_a_vendre_unit"). A Model is skipped if it no longer exists, isn’t to_sell_on_shopify = Oui, or already has an “Annonces Shopify” listing (relisted since). The others go through create_product_shopify with restore=True: variants come from units of any status (sold ones included), at 0 stock unless “A vendre”. A Model with no unit at all can’t be rebuilt (no condition or price) and is reported as a failure.

Prints a plan and asks for a typed confirmation, unless --yes; --dry-run only prints the plan; --limit N restores the first N only. Every run is recorded in create_product_shopify’s history, like any other. A rerun skips what’s already restored.

Attributes

Functions

deleted_models(runs) → dict[str, str]

{model_id: title} of every Model update_product deleted for having

skip_reason(model_id) → str | None

parse_args([argv]) → argparse.Namespace

main([argv]) → int

Module Contents

scripts.shopify.restore_deleted_products.SCRIPT_NAME = 'create_product_shopify'
scripts.shopify.restore_deleted_products.deleted_models(runs: list[dict[str, Any]]) → dict[str, str]

{model_id: title} of every Model update_product deleted for having no unit “A vendre”.

scripts.shopify.restore_deleted_products.skip_reason(model_id: str) → str | None
scripts.shopify.restore_deleted_products.parse_args(argv: collections.abc.Sequence[str] | None = None) → argparse.Namespace
scripts.shopify.restore_deleted_products.main(argv: collections.abc.Sequence[str] | None = None) → int