[FIX] l10n_es_edi_facturae: handle traceback while send an invoice to partner
When the user attempts to send an invoice to a partner whose country code is not set. Steps to produce: - Install sale_management,l10n_es_edi_facturae - Open invoicing module > Create a new invoice - Select a customer who does not have set country_id. - Click on Add a line > Select any product - Click on Confirm > Click on Send & Print > Click on save - Click on Send & Print - Error will be produced This commit addresses a `KeyError False` while the user attempts to send an invoice to a partner without a set country code. The function `_l10n_es_edi_facturae_export_facturae` uses the partner's country code but the partner doesn't have a set country code. As a result, a `KeyError` traceback is generated. Sentry-4330095746 closes odoo/odoo#130382 X-original-commit: 421d370ed30ff92a85bf7db0f4d6f1f3431b2b34 Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
@@ -551,6 +551,13 @@ msgstr ""
|
||||
msgid "The date on which the certificate starts to be valid"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_es_edi_facturae
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_es_edi_facturae/models/account_move.py:0
|
||||
#, python-format
|
||||
msgid "The partner needs a set country"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_es_edi_facturae
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_es_edi_facturae/models/account_move.py:0
|
||||
|
||||
@@ -253,6 +253,8 @@ class AccountMove(models.Model):
|
||||
raise UserError(_('The company needs a set tax identification number or VAT number'))
|
||||
if not partner.vat:
|
||||
raise UserError(_('The partner needs a set tax identification number or VAT number'))
|
||||
if not partner.country_id:
|
||||
raise UserError(_("The partner needs a set country"))
|
||||
if self.move_type == "entry":
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user