openepcis_connector_stock: lots and serial numbers
The bridge to Inventory. A lot becomes /01/<gtin>/10/<lot>, a serial number /01/<gtin>/21/<serial>, each a document of its own in the catalog under the product's GTIN: with the instance-level Digital Link and its QR code on the lot form, where labels are actually printed.
A GTIN names the model of a thing. The batch it came from and the single unit in front of you sit one level below, and GS1 expresses that level in the Digital Link path: /01/<gtin> is the model, /01/<gtin>/10/<lot> the batch and /01/<gtin>/21/<serial> the unit. The catalog stores a separate document at each level, and this addon publishes Odoo's lots and serial numbers to those paths.
| Module | openepcis_connector_stock |
| Depends on | openepcis_connector, stock |
| Installs | Automatically, once the connector and Inventory are both present |
| Talks to | The resolver's HTTP API |
| Source | openepcis-odoo · LGPL-3 |
Why a bridge
stock.lot belongs to Inventory, while the base connector depends on product only. So that an installation without Inventory carries none of this code, the addon installs itself wherever both are present. There is nothing to choose and nothing to configure beyond what the base connector already has.
Batch or unit
A lot has no GS1 key of its own; it qualifies the product's GTIN. Which qualifier it receives follows the product's tracking setting:
| Product is tracked | The lot becomes | Path | Level |
|---|---|---|---|
| By unique serial number | A serial, AI 21 | /01/<gtin>/21/<serial> | SGTIN (one unit) |
| By lots | A batch, AI 10 | /01/<gtin>/10/<lot> | LGTIN (a set) |
| Not at all, but a lot record was created on purpose | A batch, AI 10 | /01/<gtin>/10/<lot> | LGTIN |
The document carries the qualifier as a term of its own, hasBatchLotNumber or hasSerialNumber, so its content matches its URI. This also lets the resolver's linkset point at the instance itself, and a scan of a lot label lands on the lot without being redirected up to the model's GTIN.
The product goes first
An instance document hangs off the product's GTIN, and an instance under a GTIN the catalog does not hold would point at a model nobody can resolve. A lot whose product is not published yet therefore simply waits: its form says so, and it follows on its own as soon as the product lands in the catalog. This is expected behaviour and needs no action.
Otherwise the rules for products apply. Publishing is opt-in per lot, a scheduled action delivers every five minutes, and Publish now does it at once. The instance-level Digital Link and its QR code appear on the lot form, which is where a warehouse actually prints its labels.
Fields on a lot
Instance fields are ordinary rows in the field mapping on the stock.lot model, and an administrator edits them in the same way. The dates that Odoo's Expiration Dates app keeps on a lot come from a second, data-only bridge, openepcis_connector_product_expiry, so that a database without that app carries no mapping rows for fields it does not have.
Events are a separate switch
Reporting what happens to a lot, for example that it arrived, was packed or was shipped, is the job of openepcis_connector_events and a separate decision. An event names the lot whether or not an instance document exists for it, and the repository stores and finds the event either way. The instance document determines what a phone pointed at the label reaches: it reaches something only if that document was published.