| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) • Inventory (stock) |
| Community Apps Dependencies | Show |
| Lines of code | 4259 |
| Technical Name |
l10n_ro_declaration_duk |
| License | OPL-1 |
| Website | https://www.nexterp.ro |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) • Inventory (stock) |
| Community Apps Dependencies | Show |
| Lines of code | 4259 |
| Technical Name |
l10n_ro_declaration_duk |
| License | OPL-1 |
| Website | https://www.nexterp.ro |
Romania - ANAF Declaration DUKIntegrator
Validate ANAF declarations against the NextERP DUKIntegrator HTTP service.
Overview
Hooks the NextERP DUKIntegrator HTTP service into the ANAF declaration wizards so the generated XML is validated (and a printable PDF returned) before the user downloads it.
DUKIntegrator itself is the official ANAF-shipped Java tool: it cannot
be installed on read-only addon paths like Odoo.sh and ships ~200 MB
of jars plus the JVM and ANAF schema files. This module runs the tool
once on a dedicated host (duk.nexterp.ro by default) and reaches it
over HTTPS from the Odoo server.
What you get:
- a configuration block under Accounting Settings with the service URL, shared API key, request timeout and an enable/disable switch;
- a generic
l10n.ro.anaf.mixinoverride that POSTs the XML right after the local XSD check, persists DUK's verdict (valid/invalid/skipped) and stores the returned PDF as an attachment; - a view extension that surfaces the DUK badge, the validation log and the PDF on every declaration wizard (D100, D300, D390, D394, D406, D120, ...) without any per-declaration code change;
- safety rails for non-production databases (neutralized, localhost, unit tests) so staging reruns never alert the production helpdesk.
Built & supported by NextERP Romania
Romanian Odoo specialists, here for the long run — from implementation to localization and day-to-day production support.
What we do
Odoo Solutions
From quick-start rollouts to multi-company deployments and custom modules built for your processes.
Romanian Localization
SAF-T (D406), e-Factura, e-Transport, D300 / D390 / D394, ANAF integration, full chart of accounts and fiscal positions.
Our Services
Implementation, customization, migration, integration, support and consultancy — Romanian-speaking, SLA-backed.
Features
- Generic mixin override — extends
l10n.ro.anaf.mixin.validate_xmlso every wizard built on the shared base (D100, D101, D300, D390, D394, D406, D120, Intrastat, Bilant ...) is validated through DUK automatically; no per-declaration code change required. - HTTP client to the NextERP DUKIntegrator service — multipart
POST to
<url>/validatewith the declaration code, basename and XML payload,X-API-Keyauth, JSON reply parsed intoDukValidationResult. - Verdict persisted on the wizard —
duk_state(not_run/valid/invalid/skipped),duk_log(DUK stdout or the infrastructure error),duk_pdf(printable form returned by DUK, stored as attachment) andduk_pdf_filename. - Inline UI on every wizard — a DUKIntegrator Validation block is injected into the base wizard view, with a coloured badge, the log textarea and a download link for the PDF when the declaration is accepted.
- Soft-fail on production — infrastructure problems (DNS, TLS,
HTTP 5xx, timeouts, malformed JSON) become
skippedinstead of blocking the wizard; the XML is still saved and the user can retry. - Hard-fail on non-production — neutralized DBs,
localhostbase URL,test_enableorcurrent_testflags raiseUserErroron rejection / skip so failures surface immediately during development. - Per-declaration code override — wizards covering multiple ANAF
codes through versions (e.g.
l10n.ro.anaf.bilant→ S1002/S1014/...) override_get_duk_declaration_code()to send the version-correct-pargument. - Production-only alert mail — the service's failure email is
suppressed (
send_alert=false) outside production, so staging reruns never open Helpdesk tickets. - Bundled defaults via
noupdate="1"— URL, timeout and the enable flag are seeded but admin overrides survive upgrades.
Configuration
Go to Accounting -> Configuration -> Settings and locate the
ANAF DUKIntegrator Service block in the Fiscal Localizations
section. The block is only visible when the current company is set
to Romania.
Fill in:
- Enable DUK Validation — master switch. When off, every wizard
returns a
skippedresult without contacting the service. - Service URL — base URL of the validator (default
https://duk.nexterp.ro). Leave empty to bypass validation without touching the enable flag. - API Key — shared secret sent in the
X-API-Keyheader on every request. The field is masked (password="True"). - Timeout (seconds) — request timeout. SAF-T (D406) validations on
large files can take a few minutes;
300s is a safe default.
Defaults for URL, timeout and the enable flag are seeded by
data/ir_config_parameter_data.xml with noupdate="1", so admin
overrides survive module upgrades.
How the test-environment detection works
The mixin checks three signals to decide whether the database is a production one. If any of them is true, DUK alert emails are suppressed and validation failures raise immediately instead of being silently logged:
| Signal | Source |
|---|---|
tools.config['test_enable'] / modules.module.current_test |
Odoo's own unit-test flags |
database.is_neutralized set to True / 1 |
odoo neutralize or Odoo.sh staging |
web.base.url contains localhost or 127.0.0.1 |
Developer laptops |
You don't have to configure anything; the behaviour is automatic. A neutralized DB will simply never trigger a Helpdesk ticket from the service even if every declaration in it fails validation.
Storage
DUK results are stored on the wizard record itself (transient model):
duk_state, duk_log, duk_pdf (as attachment=True
binary) and duk_pdf_filename. There is nothing to clean up; the
records are garbage-collected with the standard transient cleanup
cron.
How it works
1. Run any declaration wizard
Open any ANAF declaration wizard from Accounting -> Reporting -> Romania (D100, D300, D390, D394, D406, D120, Intrastat ...) and click Execute as you normally would.
Internally:
- the underlying declaration model builds the XML;
- the shared
l10n.ro.anaf.mixin.validate_xmlruns the local XSD check first; - this module's override then POSTs the XML to
<service_url>/validatewithX-API-Keyauth, the declaration code (D300,S1002, ...) and the basename<CODE>-<VAT>-<YYYY>-<MM>; - the JSON reply is translated into a
DukValidationResultand persisted on the wizard.
2. Read the verdict
After Execute, the wizard re-renders with the DUKIntegrator Validation block visible. It shows three pieces of information:
- DUK Validation — coloured badge:
Valid(green) — DUK accepted the declaration;Invalid(red) — DUK rejected it;DUK Validation Logcontains the rejection reason;Skipped(orange) — infrastructure problem (service down, timeout, missing config), the XML is still saved and you can retry.
- DUK PDF — when DUK accepted the declaration and produced a printable form, click to download.
- DUK Validation Log — DUK's stdout / err.txt on rejection,
warnings on success, or the infrastructure error that caused the
skip. Hidden when the log is empty or equal to
"ok".
The Report File field always carries the generated XML, even on rejection — fix the source data and re-run the wizard, or download the (rejected) XML if you have a reason to.
3. Special cases
- Non-production databases: rejection and skip raise a
UserErrorinstead of being silently logged, so the failure surfaces immediately during development. - Multiple declaration codes per wizard: wizards like
l10n.ro.anaf.bilant(mapping to S1002 / S1014 / S1039 / S1070 via the version record) override_get_duk_declaration_code()to send the right-pargument to DUKIntegrator. - Service outage: turn off Enable DUK Validation from the Accounting Settings to keep generating declarations until the service is back.
Versions
19.0.0.2.4 (2026-05-24)
- Changelog tracking starts at this release.
Discover the NextERP suite
Other modules from the same publisher, built to work together.
NextERP Romania
Odoo implementation, customization, Romanian localization and long-term support since 2018.
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