Bulgarian localization configuration
Module l10n_bg_tax_adminfor Odoo 18 — fiscal positions, taxes, protocols, customs
Contents
- General architecture
- Fiscal positions
- Tax Action Maps
- Tax configuration
- NRA tags → cells
- Accounting accounts
- Distribution Lines
- Templates
- Workflows
- OSS (One Stop Shop)
- SQL Engine (reports_audit)
- EE — vat_reports
- CE — report_vat
1. General architecture
The module manages tax document processing through three layers:
Level 1: Fiscal position
account.fiscal.position
Determines which tax to replace which . Auto-apply by country, group, priority.
Level 2: Tax Action Map
account.fiscal.position.tax.action
Determines what document to generate: protocol customs private standard
Level 3: Taxes
Distribution Lines
Determines how to post and which NRA cells to place in (through tags).
2. Fiscal positions
Priority hierarchy
| Seq | Fiscal position | Country / Group | When to apply |
|---|---|---|---|
| 0 | OSS B2C (by country) | Specific EU country | B2C sales in the EU with OSS registration |
| 10 | Domestic | 🇧🇬 Bulgaria | Transactions with Bulgarian counterparties |
| 20 | EU B2C | 🇪🇺 Europe group | Sales to individuals in the EU (excluding OSS) |
| 30 | EU B2B | 🇪🇺 Europe group | Deals with EU companies (B2B) |
| 40 | Outside EU | 🌍 Unlimited | Import/export outside the EU |
| 60 | 0% Art. 69(2) | 🇪🇺 Europe group | Deliveries to another EU country |
| 61 | 0% Art. 82(2) | 🇪🇺 Europe group | Services received from the EU |
Important: Sequence determines the priority. Lower value = higher priority. OSS (seq=0) is applied before EU B2B (seq=30).
EU B2B (seq=30) — GP
Sales (outgoing invoices)
| Output tax | → | Replaced with | Tag |
|---|---|---|---|
| 20% VAT | → | 0% EU (WATER) | +15 |
| 20% Personal use | → | 0% EU (WATER) | +15 |
| 9% VAT | → | 0% EU (WATER) | +15 |
| 9% Personal use | → | 0% EU (WATER) | +15 |
| 0% Exempt | → | 0% EU (WATER) | +15 |
Purchases (incoming invoices)
| Output tax | → | Replaced with | Type |
|---|---|---|---|
| 20% OTC (without DK) | → | 20% EU PTC (ICA) | group |
| 20% FTC (full DC) | → | 20% EU PTC (ICA) | group |
| 20% PTC (partial DC) | → | 20% EU PTC (ICA) | group |
ICA (Intra-Community Acquisition): Group tax with two children — receivable and payable — which are self-cancelled through account 430000.
Outside EU (seq=40) — Input/Wear
Sales (export)
| Output tax | → | Replaced with | Tag |
|---|---|---|---|
| 20% VAT | → | 0% EX (Export) | +14 |
| 20% Personal use | → | 0% EX | +14 |
| 9% VAT | → | 0% EX | +14 |
| 0% Exempt | → | 0% EX | +14 |
Purchases (imports)
| Output tax | → | Replaced with | Type |
|---|---|---|---|
| 20% OTC | → | Customs Tariff + VAT | duty+VAT |
| 20% FTC | → | Customs Tariff + VAT | duty+VAT |
| 20% PTC | → | Customs Tariff + VAT | duty+VAT |
Customs Tariff + VAT: Group tax with customs_ratechild (tariff duty) and percentchild (20% VAT on customs value).0% Art. 69(2) — Place outside Bulgaria
| All sales taxes | → | 0% Under Art. 69(2) |
|---|---|---|
| It falls into box 23 of the reference-declaration (tag +23 ) |
0% Art. 82(2) — EU services received
| All sales taxes | → | 0% PTC Art. 80(2) |
|---|---|---|
| Reverse charge with tag +12_2 → cl. 12 |
5. Tags → Cells from VAT return
Each tag ( account.account.tag) corresponds to a specific cell of the VAT Return (Art. 125, para. 1).
Section A — Tax Charged (Sales Journal)
| Tag | Cell | Description in the reference-declaration | What falls |
|---|---|---|---|
| +11 | class 11 | VAT on taxable supplies at a rate of 20% | Tax base of all sales with 20% VAT |
| +12_1 | class 12 | DO of VOP and supplies under Art. 82, para. 2-5 | Tax base of the general income tax (ICA) |
| +12_2 | class 12 | DO of VOP and supplies under Art. 82, para. 2-5 | EU services received under Art. 82(2) |
| +13 | class 13 | VAT on taxable supplies at a rate of 9% | Sales with 9% VAT (tourism) |
| +14 | class 14 | DO of supplies under Art. 28, 140, 146 and Art. 173 | Exports, supplies of gold |
| +15 | class 15 | TO on the water | Intra-Community supplies (sales to EU companies) |
| +17 | class 17 | DO of services under Art. 21, para. 2 | Services with a recipient in another EU country (VIES) |
| +19 | class 19 | TO of exempt supplies | Exempt supplies (Art. 38-50 VAT Act) |
| +21 | class 21 | Tax charged for supplies under cl. 11 | VAT 20% = cl.11 × 20% |
| +22 | class 22 | Tax charged for general business activities and supplies under class 12 | VAT reverse charge (GPL, Art. 82, Art. 84) |
| +23 | class 23 | Delivery schedule under Art. 69, para. 2 | Place of performance in another EU country |
| +24 | class 24 | Tax charged for supplies under cl. 13 | VAT 9% = cl.13 × 9% |
| +25 | class 25 | TO of trilateral transactions by an intermediary | Trilateral transactions under Article 15 of the VAT Act |
Section B — Tax Credit (Purchase Journal)
| Tag | Cell | Description in the reference-declaration | What falls |
|---|---|---|---|
| +30 | class 30 | TO of received deliveries without right to DC | Over-the-counter (OTC) purchases |
| +31 | class 31 | TO of received deliveries with the right to full DC | Full Tax Credit (FTC) Purchases |
| +32 | class 32 | TO of received deliveries with the right to partial DC | Partial Tax Credit (PTC) Purchases |
| +33 | class 33 | Annual adjustment under Art. 73, para. 8 | Correction when changing coefficient |
| +41 | class 41 | VAT with the right to full VAT | Charged VAT = cl.31 × rate |
| +42 | class 42 | VAT with the right to partial tax credit | Charged VAT = cl.32 × rate |
| +43 | class 43 | Annual adjustment under Art. 73, para. 8 | Correction of charged VAT |
Result cells (automatically calculated)
| Cell | Description | Formula |
|---|---|---|
| class 20 | Total tax charged | кл.21 + кл.22 + кл.24 |
| class 40 | Total tax credit | кл.41 + кл.42 + кл.43 |
| class 50 | VAT for import | кл.20 − кл.40(ako ≥ 0) |
| class 60 | VAT refund | кл.40 − кл.20(if cl.40 > cl.20) |
| class 70 | Input tax — effectively | cl.50 (if there is no deduction) |
| class 80 | VAT for refund under Art. 92 | Accelerated recovery |
| class 81 | VAT for refund under Art. 92, para. 3 | Accumulated 2+ periods |
| class 82 | VAT for refund under Art. 92, para. 4 | Emergency recovery |
+ = invoice, − = refund. Odoo 18: tax_negate. The rows in gray are not configured in the demo, but are part of the declaration.
9. Workflows
Stream 1: Intra-Community Acquisition (ICAA)
- Incoming invoice from EU supplier
- Automatically FP EU B2B
- Tax → 20% EU PTC (ICA)
- TAM:l10n_bg_move_type=protocol
- Publication → protocol (10-digit number)
Sales day:
cl.12.1 + cl.22Date of purchase:
class 31 + class 41Stream 2: Import from a third country
- Incoming invoice from outside the EU
- Automatically FP Outside EU
- Tax → Customs Tariff + VAT
- TAM:l10n_bg_move_type=customs
- Setl10n_bg_currency_rate
- Publication → customs declaration
Bribe = customs_base × tariff_rate
DDS = customs_base × 20%Stream 3: EU service (Art. 82(2))
- Incoming invoice from EU service provider
- FP 0% Art. 82(2)
- Tax → 0% PTC Art. 80(2)
- TAM:l10n_bg_move_type=protocol
- Posting → protocol
Sales day:
cl.12.2 + cl.22Date of purchase:
class 31 + class 41Stream 4: Personal use
- Incoming invoice for a personal use asset
- TAM:l10n_bg_move_type=private
- Tax: 20% Private Usage
- Set personal_km and total_km
- Coefficient = (personal / general) × 100
- Base = original × (coefficient / 100)
- Publish →account.move.bg.private
10. OSS (One Stop Shop)
OSS items automatically replace Bulgarian VAT rates with the rates of the recipient's country for B2C sales.
| Country | Code | Standard | Reduced | BG 20% → | BG 9% → |
|---|---|---|---|---|---|
| 🇩🇪 Germany | OF | 19% | 7% | 19% VAT | 7% DE VAT |
| 🇫🇷 France | FR | 20% | 5.5% | 20% FR VAT | 5.5% FR VAT |
| 🇦🇹 Austria | AT | 20% | 10% | 20% AND VAT | 10% AND VAT |
| 🇮🇹 Italy | IT | 22% | 4% | 22% IT VAT | 4% IT VAT |
| 🇭🇺 Hungary | HU | 27% | 5% | 27% HU VAT | 5% HU VAT |
| 🇷🇴 Romania | RO | 21% | 11% | 21% RO VAT | 11% RO VAT |
| 🇬🇷 Greece | GR | 24% | 13% | 24% GR VAT | 13% GR VAT |
| 🇵🇱 Poland | PL | 23% | 8% | 23% PL VAT | 8% PL VAT |
| 🇪🇸 Spain | IS | 21% | 10% | 21% EU VAT | 10% EU VAT |
| 🇳🇱 Netherlands | NL | 21% | 9% | 21% NL VAT | 9% NL VAT |
| 🇧🇪 Belgium | BE | 21% | 6% | 21% VAT | 6% VAT |
| 🇸🇪 Sweden | SE | 25% | 6% | 25% SE VAT | 6% SE VAT |
| 🇩🇰 Denmark | DK | 25% | 25% | 25% DK VAT | 25% DK VAT |
| 🇫🇮 Finland | BE | 25.5% | 10% | 25.5% FI VAT | 10% FI VAT |
| 🇸🇰 Slovakia | SK | 23% | 19% | 23% SK VAT | 19% UK VAT |
| 🇨🇿 Czech Republic | CZ | 21% | 12% | 21% CZ VAT | 12% Czech VAT |
OSS items also have seq=0a specific country → apply before EU B2B (seq=30). Tax group: OSS XX.X%, sequence 1000.
11. SQL Engine — l10n_bg_reports_audit
The module l10n_bg_reports_auditprovides a 6-layer SQL hierarchy of read-only view models ( _auto=False) for calculating VAT data.
Hierarchy of SQL models
| Layer | Model | Function | GROUP BY |
|---|---|---|---|
| 1 | account.bg.calc.sales.line | Extracts tags from account_move_linesales | move_id, date |
| 1 | account.bg.calc.purchases.line | Extracts tags from account_move_linepurchases | move_id, date |
| 2 | account.bg.info.sale.line | Full information on document (sale) | move_id + partner |
| 2 | account.bg.info.purchases.line | Full information per document (purchase) | move_id + partner |
| 3 | account.bg.vat.result.declar | Calculates cl. 50, 60, 70-82 (VAT for input/refund) | move_id |
| 4 | account.bg.vat.calc.declar | Combines sales + purchases + result | company, period |
| 5 | account.bg.vat.info.declar | Final declaration with company details | company, period |
| 6 | account.bg.calc.vies.line | VIES lines by partner (tags 15, 17, 25) | partner, period |
Key SQL calculations
Tag extraction (Layer 1)
Each tag is extracted from account_account_tagusing CASE:
SUM(CASE
WHEN am.state = 'cancel' THEN 0.00
WHEN aat.tag_name = 11 AND NOT negate
THEN aml.balance
ELSE 0.00
END) * -1 AS account_tag_11
tag_name is parsed from the name:REGEXP_REPLACE(name#>>'{en_US}', '\D','','g')::numeric
Declaration formulas (Layer 4)
| class 10 | Σ(11 + 12_1 + 12_2 + 13 + 14 + 15 + 16) |
| class 20 | Σ(21 + 22 + 23 + 24) |
| class 40 | Σ(41 + 42 × коеф.33 + 43) |
| class 50 | IF (кл.20 - кл.40) > 0 THEN ABS |
| class 60 | IF (кл.20 - кл.40) < 0 THEN ABS |
cl.50/60 depend on l10n_bg_odoo_compatible: if True — calculated from SQL, if False — from declared values.
Info tags — document metadata
Sales log (info_tag_0-9)
| info_tag_0 | Company ID (VAT / UIC) |
| info_tag_1 | Tax period (YYYYMM) |
| info_tag_2 | Branch code |
| info_tag_3 | Row number (ROW_NUMBER) |
| info_tag_4 | Document type (01, 02, 03...) |
| info_tag_5 | Document number |
| info_tag_6 | Document date |
| info_tag_7 | Recipient's VAT number |
| info_tag_8 | Recipient name (multilingual) |
| info_tag_9 | Description (narrative) |
Purchase diary (info_tag_1-10)
| info_tag_1 | Tax period (YYYYMM) |
| info_tag_2 | Company ID |
| info_tag_3 | Branch code |
| info_tag_4 | Serial number |
| info_tag_5 | Document type |
| info_tag_6 | Document number |
| info_tag_7 | Document date |
| info_tag_8 | Supplier VAT number |
| info_tag_9 | Supplier name |
| info_tag_10 | Delivery description |
12. EE — l10n_bg_vat_reports (Enterprise)
Based on account_reportsa framework with custom handlers. Auto-install on l10n_bg+ account_reports.
Data flow
SQL Views
_table_query
_build_l10n_bg_query()
dictfetchall()
_create_report_line()
× N rows
WEB / PDF
CSV / ZIP
4 reports with handler classes
Declaration
Sections A/B/C/D
50+
Portrait PDF cells
Declaration.txt
Date of purchase
16 columns
80/page
Landscape PDF
Purchases.txt
Sales day
26 columns
80/page
Landscape PDF
Prodagbi.txt
WAYS
6 columns
By partner
Portrait PDF
Vies.txt
Export formats
| Format | Method | Coding | Encryption | Description |
|---|---|---|---|---|
| WEB | Frontend components | — | — | Interactive view with drill-down to documents |
| _export_to_pdf_base() | — | — | QWeb → wkhtmltopdf, landscape for diaries | |
| CSV | get_l10n_bg_csv() | CP1251 | — | Fixed width, NRA format |
| ZIP | l10n_bg_export_csvs_zip() | CP1251 | AES-256 (pyzipper) | 4 CSV files, no Zip64 |
CSV field formatting: parce_str_15() for text 15 characters, parce_fload_15_2()for amounts 15 characters with 2 decimals, parce_date_10()for date dd/mm/yyyy. Encoding CP1251 (Windows-1251) for compatibility with the National Revenue Agency.
13. CE — l10n_bg_report_vat (Community)
Wizard-based approach — does not depend on . account_reportsUses account_financial_report++ report_csv.report_zip
Flow: Wizard → Report → Export
Wizard
Date from/to
based_on
_print_report()
Format selection
_get_l10n_bg_results()
SQL views
PDF / CSV
ZIP / XLSX
Comparison of EE vs CE
| Aspect | EE (l10n_bg_vat_reports) | CE (l10n_bg_report_vat) |
|---|---|---|
| Framework | account_reports + custom handlers | Wizard + account_financial_report |
| UI model | Built-in report viewer with toolbar | Modalen wizard → Print/Download |
| Interactivity | Live filtering, drill-down | Manually running the wizard |
| Data access | Handler _get_dynamic_lines_data() | Mixin_get_l10n_bg_results() |
| SQL views | Identical — both usel10n_bg_reports_audit | |
| PDF export | QWeb → wkhtmltopdf | QWeb → wkhtmltopdf |
| CSV export | get_l10n_bg_csv() | report.report_csv.abstract |
| ZIP export | pyzipper AES-256 | report.report_zip.abstract + encryption |
| XLSX | — | report.report_xlsx.abstract(deactivated) |
| Tabov | Separate report records | Bootstrap nav-tabs в QWeb |
| Dependencies | account_reports (EE-only) | account_financial_report, report_csv, report_zip(FATHER) |
| Price | Included in EE license | 250 EUR (OPL-1) |
CE Report Models (5th class)
BGVATQwebReport
Basic QWeb PDF/HTML report. Routes to 4 sub-templates via active_tabcontext.
- declar → Portrait
- sales → Landscape
- purchase→ Landscape
- vies→ Landscape
BgVat*Csv (4th grade)
report.report_csv.abstractThey also inherit l10n.bg.export.file.
- BgVatDeclarationCsv→ Deklar.txt
- BgVatSalesCsv → Prodagbi.txt
- BgVatPurchaseCsv→ Pokupki.txt
- BgVatViesCsv → Vies.txt
BgVatBookZip
Inherits report.report_zip.abstract. Generates a ZIP with 4 CSV files.
- Callsget_l10n_bg_csv()
- prepare_zip_payload()for encryption
- Integration withl10n_bg_bank_wallet
Key: SQL view models are common for EE and CE. The only difference is in the presentation layer — EE uses account_reportsa framework, CE uses wizard + OCA report libraries.
Generated by module analysis l10n_bg_tax_admin, l10n_bg_reports_audit, l10n_bg_vat_reports, l10n_bg_report_vat— Odoo 18 Bulgarian localization