Terrabit Connect - Base
by Terrabit https://www.terrabit.ro , Dorin Hongu https://www.terrabit.roTerrabit Connect
Local hardware bridge — no open ports required
Base module for Terrabit Connect — the lightweight native agent that runs on a workstation and bridges Odoo with local hardware and services it cannot reach directly from the cloud: the ANAF token (PKCS#11 / mTLS to SPV), fiscal printers (Datecs), label printers (Zebra ZPL) and declaration validation (DUKIntegrator).
Terrabit Connect is a desktop application for Windows, macOS and Linux, built with Tauri (Rust core, the operating system's own web view). Installers and signed automatic updates are published at:
https://github.com/dhongu/terrabit-connect-releases/releases/latest
The agent's interface is in Romanian and English. By default (Auto) it follows the language of the station's company in Odoo; it can also be fixed per workstation profile.
This module is the generic foundation every Terrabit Connect feature builds on: the connection layer, the job protocol, and the one job type that is pure transport rather than a specific device — an HTTP call inside the customer's network.
✨ What it gives you
- Station registry(
deltatech.tc.station) — one record per workstation running Terrabit Connect, each with a unique API key, a last-seen timestamp and reported metadata (TC version, operating system, enabled features). - Outbound job queue(
deltatech.tc.job) — Odoo enqueuespendingjobs; the station claims them, executes them locally, and reports back the result (done/error). - REST endpointsauthenticated with the
X-Station-Keyheader:/tc/heartbeat,/tc/poll,/tc/result,/tc/config/<id>. http_requestjob type— Odoo asks the station to call a device that answers only inside the local network (a sorting line, a scale, a PLC, a label server) and reports the response back. Queue it with_tc_enqueue_http()and read the answer withresponse_dict()/response_json().pg_queryjob type— for the Terrabit Connect PostgreSQL agent (a Windows service, separate from the desktop app): Odoo asks for one page of a read-only query on a database in the customer's network (e.g. orders from a local production database) — SQL written in the feature module, or a named query installed on the station — and receives the rows; the next pages are queued automatically. Queue it with_tc_enqueue_pg_query()and read the rows withpg_rows().
Cloud model — no inbound ports. The station always initiates the connection to Odoo; Odoo never connects back to the workstation. The same agent works with on-premise and cloud deployments without opening any port on the client side.
Extensible. Feature modules add device-specific job types (selection_add on
job_type) and turn the station's result into business records by extending the
_process_result hook — keeping the registry, queue and transport in one place.
Security of http_request — read this before using it. The allow-list of
reachable hosts is configured in the agent, on the workstation, never from
Odoo. Without that rule, a job saying "call this URL" would let anyone able to
create a job in Odoo reach any address inside the customer's network. Odoo only
validates the shape of the request (scheme, host present, known method); the
decision to actually place the call belongs to the machine sitting in that
network.
Security of pg_query. Odoo names a profile (a database configured on the
station, never a host or a user) and sends either SQL or the name of a query file
installed there. SQL is accepted only on profiles where the station allows it
(allow_sql). Each page is a single SELECT with bound parameters, in a read-only
transaction with a timeout, under a database user that should only be able to read
what Odoo needs: that user's grants are the boundary of what Odoo can read.
Callbacks are restricted to methods whose name starts with _tc_. The method
name is stored in the database, so without that rule a modified record could call
any ORM method. The prefix also makes "reachable from a job" a property you can
grep for.
Security groups
Assign users to the appropriate group under Settings → Users & Companies → Users (field Terrabit Connect):
| Group | Access |
|---|---|
| User | Can view stations and jobs (read-only) |
| Manager | Full access: create/edit stations, download config, regenerate keys, view job details |
The administrator (base.user_admin) is a Manager by default.
Only Managers can access the Settings → Terrabit Connect menus and download
station.conf files (the endpoint /tc/config/<id> checks the Manager group).
Station registration
Each physical workstation that runs Terrabit Connect needs one station record in Odoo:
- Go to Settings → Terrabit Connect → Stations → New.
- Set Name (identifies the workstation in job logs and notifications).
- Set Company (defaults to the user's company; used for multi-company job routing).
- Save to generate the API Key automatically.
The API key is the credential the agent uses in the X-Station-Key HTTP header.
It is displayed masked in the form and visible only to system administrators.
Station configuration file (station.conf)
After registering a station, click Download config on the station form. The downloaded file contains two environment variables consumed by Terrabit Connect:
| Variable | Description |
|---|---|
TERRABIT_ODOO_BASE |
Base URL of the Odoo instance (e.g. https://yourcompany.odoo.com) |
TERRABIT_STATION_KEY |
The station's API key — treat it as a secret |
In Terrabit Connect, import station.conf from Settings → Import config
(Setări → Importă config in the Romanian interface). The values are stored in the active profile of
the workstation (~/.terrabit-anaf-agent/profiles/<profile>.conf) and applied
without a restart.
The agent's interface language is set in Settings → Appearance → Language:
Auto (default) follows the language of the station company's partner, sent by
Odoo in the heartbeat answer (Romanian for ro_RO, English otherwise); Română
or English fix it for the workstation profile (TERRABIT_LANG=ro / en).
No other network configuration is required: the agent initiates all connections
outbound to Odoo (no inbound port needs to be opened on the client side).
Job polling and heartbeat (workstation side)
The heartbeat runs on its own: once at start-up, then every 300 seconds. Job polling is off until you turn it on in the station profile:
| Variable | Default | Effect |
|---|---|---|
TERRABIT_POLL_JOBS |
off | 1 lets the station claim and run jobs from /tc/poll. While it is off, jobs queued in Odoo stay pending |
TERRABIT_POLL_SEC |
30 | Seconds between /tc/poll calls (minimum 5) |
Queue settings (Odoo side)
System parameters (Settings → Technical → System Parameters), all optional:
| Parameter | Default | Effect |
|---|---|---|
deltatech_tc.claim_timeout_minutes |
15 | A claimed job without result after this long counts as lost. 0 turns recovery off |
deltatech_tc.max_attempts |
3 | Offers of a retry-safe job before it fails |
deltatech_tc.done_ttl_days |
30 | Finished jobs older than this are deleted by the hourly cleanup (0 = keep) |
deltatech_tc.done_ttl_hours |
0 | When set, finished jobs go after this many hours instead (0 = use the days) |
deltatech_tc.pg_done_ttl_hours |
6 | Finished pg_query pages go after this many hours (0 = like the other jobs) |
deltatech_tc.error_ttl_days |
7 | Same for jobs in error (90 before 20.0.1.6.0) |
deltatech_tc.group_errors |
1 | A repeated error (same station, job type, callback and error code) keeps only its latest job, with Repeats and First error. 0 keeps every job |
deltatech_tc.pending_ttl_hours |
0 | Pending jobs no station picked up expire after this long. 0 = never |
Keep the claim timeout above the longest job you run (a DUKIntegrator validation, a slow device): a retry-safe job that is still running when it expires is executed twice.
Hosts reachable by http_request (workstation side)
http_request jobs are refused unless the target host is allow-listed on the
workstation. The list is deliberately not manageable from Odoo: it is the last
line of defence if an Odoo account is compromised.
TERRABIT_HTTP_ALLOW=192.168.1.50:8080,unisorter.local
Comma-separated host or host:port entries. An entry without a port allows any
port on that host; with a port, the match is exact. The default is empty — until
a host is listed there, every http_request job comes back as an error. Keep it
as narrow as the job actually needs.
Terrabit Connect PostgreSQL (workstation side)
The PostgreSQL agent is a separate Windows service (tc-postgresql), installed from
the release zip with install.ps1, with its own station and key. Its configuration
lives in %ProgramData%\Terrabit\tc-postgresql\:
station.confdownloaded from the station (or[odoo]inconfig.toml);config.toml: one[profiles.<name>]per database (host, database, a read-only user, timeouts, page limits); passwords encrypted withtc-postgresql secret set <profile>(Windows DPAPI).allow_sql = truelets Odoo send SQL for the profile (featurepg_sql:<profile>): give that database userSELECTonly, only on the schema or tables Odoo needs — its grants are what Odoo can read;queries\<profile>\*.sql(optional): named queries, for profiles withoutallow_sql.
tc-postgresql check verifies the files, the database and the Odoo connection. The
station form then shows Agent tc-postgresql, the features postgresql,pg:<profile>
and the installed queries. The agent updates itself from signed releases.
On the Odoo side, deltatech_tc.pg_done_ttl_hours (default 6) sets how long finished
pg_query pages are kept: their data is already in the records of the calling module, and a
synchronization reads thousands of them. The former deltatech_tc.pg_done_ttl_days still
counts (in days) when only it is set; 0 there, as before, keeps the pages like the other jobs.
The server applies a 60-second throttle on last_seen writes to reduce database
load when many stations are polling frequently; online detection remains accurate
within the throttle window.
Registering a station
- Go to Settings → Terrabit Connect → Stations. The list shows, for each station, when it was Last Seen, its TC Version and whether it runs in Simulation (highlighted rows).
- Click New and give the station a descriptive name (e.g.
Accounting PC). - Select the company the station belongs to (multi-company installations).
- Save. An API Key is generated automatically and is visible to administrators only (shown masked in the form).
- Click Download config (download icon in the header) — Odoo serves a
pre-filled
station.conffile containing:TERRABIT_ODOO_BASE=<your Odoo URL> TERRABIT_STATION_KEY=<the generated key> - Copy
station.confto the workstation and import it in Terrabit Connect (Setări → Importă config). The agent authenticates with theX-Station-Keyheader on every call.
Verifying connectivity
Once Terrabit Connect is running with the downloaded config:
- Open the station form (Settings → Terrabit Connect → Stations, click the station).
- The Last Seen field updates at the first heartbeat, sent as soon as the agent starts, and then at every heartbeat or job poll.
- Click Ping in the header to enqueue a round-trip test job. The job appears
in the Jobs smart button and reaches state
Doneat the next poll — provided job polling is enabled on the workstation (TERRABIT_POLL_JOBS=1, see CONFIGURE). - Terrabit Connect managers also receive a browser notification when the agent sends a manual heartbeat.
Simulated stations
When Terrabit Connect runs in simulation mode, the station reports at every heartbeat the fiscal
driver simulated and the simulated devices: fiscal for the cash register and terminal:<id> for
each card terminal. The station form then shows a Simulation ribbon and a warning listing the
simulated devices; receipts and card payments made through them are not real. The marking comes from
the station: it disappears on its own at the first heartbeat sent without simulated devices.
Monitoring jobs
Navigate to Settings → Terrabit Connect → Jobs to see all jobs across all
stations. You can filter by state (Pending, Claimed, Done, Error) or group by
station or job type.
The job list uses colour coding:
- Green row —
Done - Red row —
Error(open the form to read the error detail) - Muted row —
Claimed(the station picked it up; result not yet reported)
Open a job to read its Payload, Result and Error tabs.
Lost results and retries
A job whose result never came back (agent restarted, network down between execution and reply) is handled after the claim timeout (see CONFIGURE):
- retry-safe jobs (
ping,http_requestwithGETorHEAD) are offered to the station again, then fail after the maximum number of attempts; - all other jobs stay
Claimed, because they may already have run. Find them with the Claimed filter, check on the device or at ANAF whether the operation happened, and only then use Retry on the job form (managers only).
Retry also puts a job in Error back in the queue.
A feature module whose job type only reads can declare it retry-safe:
def _tc_is_retry_safe(self):
return self.job_type == "sync_messages" or super()._tc_is_retry_safe()
Rotating the API key
If a station key is compromised:
- Open the station form.
- Click Regenerate key and confirm the prompt.
- Download the updated
station.confand deploy it to the workstation. Terrabit Connect will fail to authenticate until it is reconfigured with the new key.
Staging and other copies of the database
When the database is copied and neutralized (an odoo.sh staging or development branch, or
odoo-bin neutralize), every station of the copy gets a new key, so the agents of
production never serve the copy and an agent set up for the copy can not authenticate on
production. Jobs that were still Pending or Claimed are closed in Error instead of
being run a second time. To test on the copy, download station.conf from the copy and use it
on a test station (for the PostgreSQL agent: a [connections.staging] entry).
Calling a device on the local network
Queue the call from a feature module:
station = self.env["deltatech.tc.station"].search([("company_id", "=", self.env.company.id)], limit=1)
self.env["deltatech.tc.job"]._tc_enqueue_http(
station,
"http://192.168.1.50/api/Lines/1/Lots",
headers={"X-API-KEY": self.api_key},
timeout=30,
callback=(self, "_tc_apply_lots"),
)
Handle the response on the record that asked for it:
def _tc_apply_lots(self, job):
response = job.response_dict()
if response.get("status") != 200:
raise UserError(self.env._("The device answered %(code)s.", code=response.get("status")))
for payload in job.response_json() or []:
...
The callback method must start with _tc_ — see DESCRIPTION. Before the first
job can succeed, the target host has to be allow-listed on the workstation (see
CONFIGURE).
The call is asynchronous. It runs when the station next polls, not when the job is created. Interactive buttons must therefore show a pending state and let the result arrive later; do not queue a job and read its result in the same transaction.
Reading a PostgreSQL database in the local network
Install the Terrabit Connect PostgreSQL agent on a server that reaches the database
(its own station, not the one of the desktop app), with allow_sql = true on the profile,
and queue pages from a feature module; the SQL lives in the module:
ORDERS_SINCE = """
SELECT id, name, confirmed_at
FROM erp.orders
WHERE confirmed_at >= %(since)s
AND (%(after)s::bigint IS NULL OR id > %(after)s)
ORDER BY id
"""
station = self.env["deltatech.tc.station"]._tc_find("pg:erp")
if not station._tc_has_pg_sql("erp"):
raise UserError(self.env._("The ERP station does not accept SQL from Odoo (allow_sql)."))
self.env["deltatech.tc.job"]._tc_enqueue_pg_query(
station,
"erp",
sql=ORDERS_SINCE,
key="id",
params={"since": "2026-11-01 00:00:00"},
page_size=500,
callback=(self, "_tc_receive_orders"),
)
%(name)s parameters are bound by the station, never pasted into the SQL; PostgreSQL infers
their types, so add a cast where it cannot (%(after)s::bigint IS NULL). With key, the SQL
must page on that column with %(after)s. On a profile without allow_sql, name a query file
installed in its queries\<profile>\ folder instead (_tc_enqueue_pg_query(station, "erp",
"orders_since", params=...), checked with _tc_has_pg_query).
The station form then shows the agent and the installed queries:
The callback runs once per page, and once more if a page fails:
def _tc_receive_orders(self, job):
if job.state == "error":
self.message_post(body=job.pg_error().get("message"))
return
for row in job.pg_rows():
... # idempotent: a page may arrive twice after a lost result
The next page is queued after the callback returns; if it raises, the page is marked
Error and Retry takes the chain up from that page. numeric values arrive as
text (no precision lost), dates and timestamps as ISO text.
Adding feature modules
This base module does not talk to any device by itself. Install the relevant Terrabit Connect feature module (e.g. ANAF messages, fiscal printer, Zebra labels, DUKIntegrator) to activate additional job types. They appear automatically in the Job Type column of the job list once the feature module is installed.
20.0.1.6.0 (2026-12-02)
- A repeated error keeps one job: when a job fails with the same error as an earlier job in
error (same station, job type, callback and error code —
connect_failed,query_failed... forpg_query, the error text otherwise), the earlier jobs are deleted and the latest one shows Repeats and First error. A station without access to its database (VPN down) no longer leaves one job in error per minute. A different error code stays a separate job.deltatech_tc.group_errors = 0turns grouping off. - Jobs in error are kept 7 days (was 90): a repeated error now lives on in its latest job,
so the history is short. Set
deltatech_tc.error_ttl_daysto keep them longer. - The migration groups the jobs already in error the same way.
20.0.1.5.0 (2026-11-26)
- Finished
pg_querypages go after 6 hours (deltatech_tc.pg_done_ttl_hours), not 3 days: their data is already in the records of the calling module, and a synchronization reads thousands of them (on a trial odoo.sh database, one day of Winarhi pages took 300 MB of the 1 GB).deltatech_tc.pg_done_ttl_daysstill counts when only it is set (0= no early deletion, as before). deltatech_tc.done_ttl_hours: finished jobs of any type can go after a number of hours.- The queue cleanup runs every hour (was daily); the migration moves the existing cron.
20.0.1.4.1 (2026-11-19)
- Documentation, examples, tests and screenshots use a neutral
erpprofile and aServer ERPstation instead of a customer's names; no functional change.
20.0.1.4.0 (2026-11-19)
pg_queryaccepts SQL written in the calling module (_tc_enqueue_pg_query(station, profile, sql=..., key=...)), with psycopg2-style%(name)sparameters bound by the station andkeyfor keyset pagination (%(after)sin the SQL). The station runs it only on a profile withallow_sql(Terrabit Connect PostgreSQL 0.2.0, featurepg_sql:<profile>;station._tc_has_pg_sql(profile)). The read-only database user of the profile bounds what Odoo can read. Named query files on the station remain available.- The station form lists a profile without query files by its name.
20.0.1.3.1 (2026-11-19)
- Database neutralization (odoo.sh staging / development copies,
odoo-bin neutralize) gives every station a new random key, so production's agents never serve the copy and an agent set up for the copy can not authenticate on production. Jobs still pending or claimed are closed in error instead of being run a second time.
20.0.1.3.0 (2026-11-18)
- New job type
pg_queryfor the Terrabit Connect PostgreSQL agent (terrabit-solutions/terrabit-connect-postgresql), a Windows service that runs named, read-only queries on a PostgreSQL database in the customer's network. Odoo sends only the profile name, the query name and its parameters, never SQL; the.sqlfiles live on the station. One page per job, keyset pagination (after= key of the last row). _tc_enqueue_pg_query()queues the first page; withfollowthe next page is queued automatically once the callback of the current one succeeded. The callback also receives a failed page (job.state == "error",job.pg_error()gives{code, message}), including one failed after the retry limit.pg_rows()returns the rows of a page. Pages are retry-safe.- Heartbeat: the agent name (
agent) and the installed queries (pg_profiles) are stored on the station (Agent, PostgreSQL queries)._tc_find(feature)returns the company's active station announcing a feature (whole element, e.g.pg:erp);_tc_has_pg_query(profile, query)checks an installed query. - Daily cleanup: finished
pg_querypages are deleted after 3 days (deltatech_tc.pg_done_ttl_days).
20.0.1.2.7 (2026-11-15)
- The heartbeat answer (
/tc/heartbeat) carrieslang, the language of the station company's partner (en_USwhen it has none). Terrabit Connect set to Auto uses it for its interface: Romanian forro_*, English otherwise. Older agents ignore the key. - Docs: the agent's interface is available in Romanian and English.
- Port of 19.0.1.2.7 (dhongu/deltatech#4186).
20.0.1.2.6 (2026-11-15)
- Docs: screenshots of the Terrabit Connect app (main window, job queue, settings) in the description, the configuration section and the consultant sheet. The download address is now written out in full, because the Odoo Apps page turns links in the description into plain text. No code change.
20.0.1.2.5 (2026-11-15)
- Port of 19.0.1.2.5.
- The station shows the fiscal driver and the devices Terrabit Connect simulates (from the heartbeat): a Simulation ribbon and a warning on the form, highlighted rows in the list.
- Consultant sheet (
readme/FISA_CONSULTANT.md), usage with screenshots, and the test that generates them (tests/test_screenshots.py).
20.0.1.2.4 (2026-10-11)
- Docs: emoji symbols added to the bold headings of the module description, for a uniform look on the Odoo Apps page. No code change.
Older releases are listed in the module's HISTORY file.
Need help getting started?
Our 800+ apps on the Odoo Apps Store are used in Odoo implementations across Europe, the Americas, Asia and Africa — by companies we have never even met. That is the advantage of building modules that simply work.
Questions about this module? Write to us — the developers who build it will answer.
More apps by Terrabit
Other modules from the same publisher, built to work together. All apps →
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 1060 |
| Technical Name |
deltatech_tc |
| License | OPL-1 |
| Website | https://www.terrabit.ro |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module