For the complete documentation index, see llms.txt. This page is also available as Markdown.

Omnitron Shipment Client

OmnitronShipmentClient can produce a shipping label (cargo label) in two ways:

  1. Local generation (default): The label is generated inside OMS via get_label_data.

  2. Fetch from Omnitron: The label is retrieved from the shipping-info record on Omnitron (cargo_label).

Which path is used is controlled by two independent flags under shipper_info.strategies.

Strategies

Strategy
Default
Description

fetch_label

false

If true, the label is fetched from Omnitron; if false, it is generated locally.

fetch_label_only_for_4p

false

Only meaningful when fetch_label = true. If true, the label is fetched from Omnitron only for orders where extra_field.is4P evaluates to true; for all other orders the label is generated locally. If false (default), the is4P check is skipped and the label for all orders is fetched from Omnitron.

Behavior Table

fetch_label

fetch_label_only_for_4p

extra_field.is4P

Result

false

Label is generated locally

true

false (default)

any

Label is fetched from Omnitron

true

true

true / "true"

Label is fetched from Omnitron

true

true

false / missing / "false"

Label is generated locally

The is4P value is supported both as a boolean (true) and as a string ("true"). For string values, case and leading/trailing whitespace are ignored (e.g. " True " is accepted as true). Any other value (false, 0, null, or the field being absent entirely) is treated as "not 4P".

How to Configure shipper_info in a Cargo Condition

In the example condition from the original question, shipper_info was empty:

If you want labels for 4P orders to be fetched from Omnitron, shipper_info should be filled in as follows:

Full example of a cargo company condition:

If you want labels to be fetched from Omnitron for all orders (without distinguishing 4P), either omit fetch_label_only_for_4p entirely or leave it as false; just "fetch_label": true is enough.

Marking an Order as 4P

For the label to be fetchable from Omnitron (when fetch_label_only_for_4p = true), the order's extra_field must contain the is4P information:

API Service Used

When the fetch_label condition (and is4P, if required) is satisfied, the label is fetched from Omnitron via OmnitronApiClient.get_shipping_info.

  • Endpoint: GET /order_shipping_infos/?order={omnitron_id}&sort=-created_date

  • Full URL: {OMNITRON_BASE_URL}/order_shipping_infos/?order={omnitron_id}&sort=-created_date

  • Auth: Omnitron client token header (added automatically by the client)

  • The client takes the first record from the returned results list (the most recent one, due to sort=-created_date) and uses its cargo_label value as the label URL.

Example Request

Example Response

Return Value of OMS's get_shipping_label

get_shipping_label returns a (label_data, label_url) tuple:

Scenario

label_data

label_url

Fetched from Omnitron (response present)

None

cargo_label URL (e.g. https://omnitron.example.com/cargo-label/123/)

Fetched from Omnitron but shipping_info is empty/None

None

None

Generated locally

ContentFile (HTML)

OMS label URL

On the Omnitron-fetch path, label_data is always None; the label arrives as an external URL (label_url). On the local-generation path, the label content is returned as a ContentFile inside label_data.

Summary Flow

Last updated

Was this helpful?