| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Sales (sale_management) • Purchase (purchase) • Discuss (mail) |
| Community Apps Dependencies | Show |
| Lines of code | 10104 |
| Technical Name |
eh_log_l10n_om_customs |
| License | LGPL-3 |
| Website | https://www.erpheritage.com.au/ |
| Versions | 16.0 17.0 18.0 19.0 |
Oman Customs (Bayan) Adapter
The Oman customs pack for the logistics suite: a Bayan JSON adapter, seven Oman declaration types, and Oman HS overlays, all on the suite's audited submit-and-status engine.
Why this module
Oman Customs (Bayan) Adapter
A real Bayan adapter, not a placeholder
The module ships a working subclass of the suite's BaseAdapter for the Oman Royal Oman Police Customs single window. It serializes the neutral declaration payload into the Bayan JSON envelope, submits it, parses the response, and surfaces the regulator-issued declaration number back onto the record. Declaration submit and status are both implemented and tested.
Mock-mode profile seeded at install
A Bayan adapter profile is seeded in mock mode at install, pointed at the sandbox endpoint with sensible timeout, retry, and circuit-breaker defaults. Submit a declaration against it and the engine replays a captured fixture through the exact same code path as production, so a fresh install demonstrates the full flow with no credentials and no network call.
Oman types and HS overlays on the shared master
Seven Oman-scoped declaration types (import, export, transit, re-export, temporary admission, GCC inter-state, import to free zone or SEZ) and a starter set of Oman HS tariff overlays at the 5 percent VAT baseline are seeded on top of the suite's universal master. Country data appends, it does not overwrite the global hierarchy.
Day in the life
Filing an Oman import declaration
A broker opens a customs declaration born from the freight job, picks the Oman import type, adds HS lines with customs value, and points it at the seeded Bayan regulator profile. The engine's pre-flight guards block the move to ready until every line has an HS code and a non-zero value and a regulator profile is set. On submit, the Bayan adapter serializes the payload, dispatches it (or replays the mock fixture), captures the regulator declaration number, and writes the full request and response to the audit message log with the authorization header redacted. If Bayan rejects the payload, the declaration moves to rejected and the error code lands in the chatter.
Edge cases
The cases most modules quietly ignore.
In the shipped code today, each one a place where a cheaper module silently does the wrong thing.
If Bayan returns malformed JSON on a submit response, the parser raises a typed AdapterValidationError with the underlying decode error rather than silently swallowing it. On a status response the parser degrades gracefully and returns an unknown status with the raw body preserved.
The engine sends a stable idempotency key on submit (built from the declaration id and broker reference), so a retried or replayed submission can be deduplicated by the regulator rather than creating a duplicate declaration.
When consecutive outbound calls hit the configured threshold (five by default) and the cooldown has not elapsed, the circuit breaker opens and the next call is recorded as a dead letter with a BREAKER_OPEN code instead of hammering a downed regulator endpoint.
Every request and response is written to the audit message log, but the authorization, api-key, and cookie headers are redacted before storage and oversized payloads are truncated, so the Bayan bearer token never lands in the database.
The adapter pins the Bayan API version and the base raises in the constructor if a profile's api_version does not match, so a regulator schema bump becomes a deliberate adapter upgrade rather than a silent broken dispatch.
Credentials resolve through a documented precedence (environment variable, then encrypted system parameter, then caller default) scoped by company, so one Odoo install can dispatch to two companies' Bayan accounts.
What is inside
Built to do the job, end to end.
- Bayan adapter. A concrete BayanAdapter (provider code bayan, API version 1.0) registered at import. Implements serialize and parse for declaration_submit and declaration_status, plus a health_check probe. JSON contract, GET for status and health, POST for submit, with a bearer-token authorization header injected from the credentials helper.
- Oman declaration types. Seven country-scoped records on eh.log.customs.declaration.type: import, export, transit, re-export, temporary admission, GCC inter-state movement, and import to free zone or SEZ. Import is flagged as requiring a deferment account so the engine's submit guard enforces it.
- Oman HS overlays. A starter set of six Oman-scoped HS subheadings (smartphones, portable computers, passenger vehicles, cigarettes, medicaments, carbonated beverages) carrying default duty and VAT rates at the 5 percent Oman VAT baseline, seeded as append-only overlays on the shared HS master.
- Seeded mock-mode profile. One eh.log.adapter.profile record, Bayan (Oman Default), seeded at install in mock environment with the sandbox endpoint, a 60 second timeout, three retry attempts, and a five-failure breaker threshold with a 120 second cooldown.
- Inherited suite engine. From the suite base: a single call orchestrator handling retry with exponential backoff and jitter, the circuit breaker, mock-fixture replay, the append-only audit message log with header redaction and payload truncation, and the multi-source credential precedence chain.
- Test fixtures and coverage. Captured Bayan fixtures for an accepted submission, a rejected submission, and a health check, exercised by tests covering registry registration, profile seeding, JSON serialization, success and rejection parsing, and a full mock-mode round trip.
Honest about the edges
What this does not do, so nothing surprises you.
- This is a customs declaration adapter, not a full freight or transport management system. Shipment legs, quotation costing, container and seal tracking, and tracking-event ingest live in other modules of the suite, not here.
- The module ships no menus, views, or dashboards of its own. It contributes the Bayan adapter, data records, and a profile; the declaration UI comes from the customs engine dependency.
- The seeded profile is mock mode. Production filing against the live Royal Oman Police Customs Bayan endpoint requires real credentials, the live endpoint URL, and confirmation that your Bayan API version matches the adapter's pinned version 1.0.
- The adapter implements declaration submission and status polling only. There is no declaration amendment message type and no scheduled status-polling cron in this module; status is fetched on demand through the engine.
- The HS overlays are a starter set of six representative subheadings, not a complete Oman national tariff schedule. The rates reflect the 2026 baseline and should be reviewed against current Royal Oman Police Customs and Oman Tax Authority figures before live use.
- The Bayan JSON envelope is mapped to the documented contract. Field-level alignment with the production single window should be verified during onboarding before going live.
Oman customs Odoo, Bayan single window adapter, Royal Oman Police Customs, GCC customs declaration software, Odoo 17 logistics customs, freight forwarder customs broker, Oman HS code tariff, customs deferment account, 3PL customs integration, Oman import export declaration, Sohar Salalah Duqm logistics, OMR customs duty VAT
Languages
Available in 19 languages
The interface ships translated out of the box. Switch language in Odoo and the fields, menus, and messages follow.
Modules teams pair with this one.
Premium ERP Heritage modules that extend the same stack, each built to the same engineering bar.
A dependency free asynchronous job queue that runs long running and fan out work out of band of the request that...
Post Irish payslips to the general ledger on the Irish chart of accounts
Interactive drag and drop Gantt planner for Odoo 17 Community project tasks with a deterministic server side sche...
Employment Hero Connector is the integration core of the ERP Heritage Employment Hero suite, providing per compan...
The United Kingdom country pack for the ERP Heritage Employment Hero integration
Sync Employment Hero employees, departments and payroll bank details into standard Odoo Community HR over the pla...
Please log in to comment on this module