From bfaccfcdae5cf00e5129f932c455d5d2a8677bc1 Mon Sep 17 00:00:00 2001 From: "Antoine Dupuis (andu)" Date: Tue, 27 Jun 2023 13:51:18 +0000 Subject: [PATCH] [IMP] l10n_ro: Minor changes for l10n_ro_saft For the l10n_ro_saft module that generates the D.406 declaration, we needed to: - create a new export tax specifically for services (which should be reported separately from goods); and - make sure the Bank, Outstanding Receipts and Outstanding Payments accounts are created with codes 5121xx, and the Cash account with code 5311xx, because codes 5120 and 5130 are not available in the official CoA and were therefore causing validation errors in the SAF-T export. - because the CUI number (found in the company_registry field) for partners is required for the SAF-T export, and it is substantially the same as the VAT number, re-use logic from l10n_be to automatically fill in the company_registry if the VAT exists. closes odoo/odoo#132269 Task-id: 3172198 X-original-commit: 74be0779164f8cd65c399977d5f3e058c213318d Related: odoo/enterprise#45939 Related: odoo/documentation#5532 Signed-off-by: Brice Bartoletti (bib) Signed-off-by: Antoine Dupuis (andu) --- .../data/template/account.fiscal.position-ro.csv | 8 ++++---- addons/l10n_ro/data/template/account.tax-ro.csv | 6 +++++- addons/l10n_ro/models/res_partner.py | 13 +++++++++++++ addons/l10n_ro/models/template_ro.py | 4 ++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/addons/l10n_ro/data/template/account.fiscal.position-ro.csv b/addons/l10n_ro/data/template/account.fiscal.position-ro.csv index 3cd5c39d1f1..b24da6ecf56 100644 --- a/addons/l10n_ro/data/template/account.fiscal.position-ro.csv +++ b/addons/l10n_ro/data/template/account.fiscal.position-ro.csv @@ -117,10 +117,10 @@ "","","","","","","","tvac_05","tvati_extra","" "","","","","","","","tvac_09","tvati_extra","" "","","","","","","","tvac_19","tvati_extra","" -"","","","","","","","tvac_00_s","tvati_extra","" -"","","","","","","","tvac_05_s","tvati_extra","" -"","","","","","","","tvac_09_s","tvati_extra","" -"","","","","","","","tvac_19_s","tvati_extra","" +"","","","","","","","tvac_00_s","tvati_extras","" +"","","","","","","","tvac_05_s","tvati_extras","" +"","","","","","","","tvac_09_s","tvati_extras","" +"","","","","","","","tvac_19_s","tvati_extras","" "","","","","","","","tvad_00","tvati_extrap0b","" "","","","","","","","tvad_05","tvati_extrap0b","" "","","","","","","","tvad_09","tvati_extrap0b","" diff --git a/addons/l10n_ro/data/template/account.tax-ro.csv b/addons/l10n_ro/data/template/account.tax-ro.csv index 297ca6499cc..ed665452557 100644 --- a/addons/l10n_ro/data/template/account.tax-ro.csv +++ b/addons/l10n_ro/data/template/account.tax-ro.csv @@ -153,7 +153,11 @@ "","","","","","","","","","","","tax","invoice","","","","" "","","","","","","","","","","","base","refund","-03 - TAX BASE","","","" "","","","","","","","","","","","tax","refund","","","","" -"tvati_extra","35","VAT Exportation","","0% EX","0.0","percent","sale","tax_group_tva_scutit","","","base","invoice","+14 - TAX BASE","","","TVA Export" +"tvati_extra","35","VAT Exportation Goods","","0% EX G","0.0","percent","sale","tax_group_tva_scutit","","","base","invoice","+14 - TAX BASE","","","TVA Export Bunuri" +"","","","","","","","","","","","tax","invoice","","","","" +"","","","","","","","","","","","base","refund","-14 - TAX BASE","","","" +"","","","","","","","","","","","tax","refund","","","","" +"tvati_extras","35","VAT Exportation Services","","0% EX S","0.0","percent","sale","tax_group_tva_scutit","","","base","invoice","+14 - TAX BASE","","","TVA Export Servicii" "","","","","","","","","","","","tax","invoice","","","","" "","","","","","","","","","","","base","refund","-14 - TAX BASE","","","" "","","","","","","","","","","","tax","refund","","","","" diff --git a/addons/l10n_ro/models/res_partner.py b/addons/l10n_ro/models/res_partner.py index 32b5457558d..b991260a0d8 100644 --- a/addons/l10n_ro/models/res_partner.py +++ b/addons/l10n_ro/models/res_partner.py @@ -18,3 +18,16 @@ class ResPartner(models.Model): return super(ResPartner, self)._commercial_fields() + ['nrc'] nrc = fields.Char(string='NRC', help='Registration number at the Registry of Commerce') + + @api.depends('vat', 'country_id') + def _compute_company_registry(self): + # OVERRIDE + # In Romania, if you have a VAT number, it's also your company registry (CUI) number + super()._compute_company_registry() + for partner in self.filtered(lambda p: p.country_id.code == 'RO' and p.vat): + vat_country, vat_number = self._split_vat(partner.vat) + if vat_country.isnumeric(): + vat_country = 'ro' + vat_number = partner.vat + if vat_country == 'ro' and self.simple_vat_check(vat_country, vat_number): + partner.company_registry = vat_number diff --git a/addons/l10n_ro/models/template_ro.py b/addons/l10n_ro/models/template_ro.py index 5086d071f56..924e0e6f477 100644 --- a/addons/l10n_ro/models/template_ro.py +++ b/addons/l10n_ro/models/template_ro.py @@ -22,8 +22,8 @@ class AccountChartTemplate(models.AbstractModel): return { self.env.company.id: { 'account_fiscal_country_id': 'base.ro', - 'bank_account_code_prefix': '512', - 'cash_account_code_prefix': '531', + 'bank_account_code_prefix': '5121', + 'cash_account_code_prefix': '5311', 'transfer_account_code_prefix': '581', 'account_default_pos_receivable_account_id': 'ro_pcg_recv', 'income_currency_exchange_account_id': 'pcg_7651',