From d9ee3a019ef0b4ec598a32e2bcb4ec51df535921 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Thu, 24 Mar 2022 14:13:12 +0000 Subject: [PATCH] [FIX] l10n_fr_fec: allows exporting FEC without TVA number. Not all company needs a French TVA number but still needs to provide FEC file. Improve that by making the TVA number optional, allowing to export the FEC file without it. The only difference is that in such case, the vat number won't be appended to the file name. Task id #2801629 closes odoo/odoo#87620 X-original-commit: 59937bbea86a9d01bb7038f7e307fd88fbb82976 Signed-off-by: Olivier Colson Signed-off-by: Nicolas Viseur --- addons/l10n_fr_fec/wizard/account_fr_fec.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index 12b544e7230..561e49fe3d7 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -96,18 +96,12 @@ class AccountFrFec(models.TransientModel): """ dom_tom_group = self.env.ref('l10n_fr.dom-tom') is_dom_tom = company.account_fiscal_country_id.code in dom_tom_group.country_ids.mapped('code') - if is_dom_tom: + if not company.vat or is_dom_tom: return '' - elif company.country_id.code == 'FR': - if not company.vat: - raise UserError(_("Missing VAT number for company %s") % company.display_name) - elif len(company.vat) < 13 or not siren.is_valid(company.vat[4:13]): - raise UserError(_("Invalid VAT number for company %s") % company.display_name) - else: - return company.vat[4:13] + elif company.country_id.code == 'FR' and len(company.vat) >= 13 and siren.is_valid(company.vat[4:13]): + return company.vat[4:13] else: - return '' if not company.vat else company.vat - + return company.vat def generate_fec(self): self.ensure_one()