Skip to content

Commit

Permalink
[IMP] l10n_es_facturae: Make it work for physical people
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa committed Mar 27, 2024
1 parent 1fbe171 commit 1b262bb
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
6 changes: 0 additions & 6 deletions l10n_es_facturae/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,6 @@ msgstr "Otro"
msgid "Oficina Contable not provided"
msgstr "La Oficina Contable es obligatorio"

#. module: l10n_es_facturae
#: code:addons/l10n_es_facturae/models/account_move.py:0
#, python-format
msgid "Organo Gestor not provided"
msgstr "El Organo Gestor es obligatorio"

#. module: l10n_es_facturae
#: code:addons/l10n_es_facturae/models/account_move.py:0
#, python-format
Expand Down
6 changes: 0 additions & 6 deletions l10n_es_facturae/i18n/l10n_es_facturae.pot
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,6 @@ msgstr ""
msgid "Oficina Contable not provided"
msgstr ""

#. module: l10n_es_facturae
#: code:addons/l10n_es_facturae/models/account_move.py:0
#, python-format
msgid "Organo Gestor not provided"
msgstr ""

#. module: l10n_es_facturae
#: code:addons/l10n_es_facturae/models/account_move.py:0
#, python-format
Expand Down
2 changes: 0 additions & 2 deletions l10n_es_facturae/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ def validate_facturae_fields(self):
raise ValidationError(_("Partner vat is too small"))
if not self.partner_id.state_id:
raise ValidationError(_("Partner state not provided"))
if not self.partner_id.organo_gestor:
raise ValidationError(_("Organo Gestor not provided"))
if not self.partner_id.unidad_tramitadora:
raise ValidationError(_("Unidad Tramitadora not provided"))
if not self.partner_id.oficina_contable:
Expand Down
6 changes: 0 additions & 6 deletions l10n_es_facturae/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,12 +769,6 @@ def _create_wizard_facturae_file(self):
)
return wizard

def test_create_facturae_file_without_organo_gestor(self):
wizard = self._create_wizard_facturae_file()
self.partner.organo_gestor = False
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()

def test_create_facturae_file_without_unidad_tramitadora(self):
wizard = self._create_wizard_facturae_file()
self.partner.unidad_tramitadora = False
Expand Down
6 changes: 3 additions & 3 deletions l10n_es_facturae/views/report_facturae.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<FirstSurname
t-length="40"
t-esc="administrative_partner.lastname if administrative_partner._fields.get('lastname') else ''"
t-if="not partner.is_company"
t-if="not partner.is_company and administrative_partner.lastname if administrative_partner._fields.get('lastname') else ''"
/>
<SecondSurname t-if="False" />
<t t-call="l10n_es_facturae.address_contact" />
Expand Down Expand Up @@ -119,9 +119,9 @@
/>
<FirstSurname
t-length="40"
t-esc="partner.lastname if partner._fields.get('lastname') else ''"
t-esc="partner.lastname if partner._fields.get('lastname') else '.'"
/>
<SecondSurname t-length="40" t-esc="''" />
<SecondSurname t-length="40" t-esc="''" t-if="False" />
<t t-call="l10n_es_facturae.address_contact">
</t>
</Individual>
Expand Down
6 changes: 6 additions & 0 deletions l10n_es_facturae_face/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ msgstr "No solicitado"
msgid "OK"
msgstr "Aceptar"

#. module: l10n_es_facturae_face
#: code:addons/l10n_es_facturae_face/models/account_move.py:0
#, python-format
msgid "Organo Gestor not provided"
msgstr "El Organo Gestor es obligatorio"

#. module: l10n_es_facturae_face
#: model:ir.model.fields.selection,name:l10n_es_facturae_face.selection__account_move__l10n_es_facturae_status__face-2500
msgid "Paid"
Expand Down
6 changes: 6 additions & 0 deletions l10n_es_facturae_face/i18n/l10n_es_facturae_face.pot
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ msgstr ""
msgid "OK"
msgstr ""

#. module: l10n_es_facturae_face
#: code:addons/l10n_es_facturae_face/models/account_move.py:0
#, python-format
msgid "Organo Gestor not provided"
msgstr ""

#. module: l10n_es_facturae_face
#: model:ir.model.fields.selection,name:l10n_es_facturae_face.selection__account_move__l10n_es_facturae_status__face-2500
msgid "Paid"
Expand Down
9 changes: 8 additions & 1 deletion l10n_es_facturae_face/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).


from odoo import api, fields, models
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class AccountMove(models.Model):
Expand Down Expand Up @@ -83,3 +84,9 @@ def _get_l10n_es_facturae_excluded_status(self):
"face-2600",
"face-3100",
]

def validate_facturae_fields(self):
super().validate_facturae_fields()
if not self.partner_id.organo_gestor:
raise ValidationError(_("Organo Gestor not provided"))
return
13 changes: 13 additions & 0 deletions l10n_es_facturae_face/tests/test_facturae_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@ def test_facturae_face_error(self):
exchange_record.backend_id.exchange_send(exchange_record)
self.assertEqual(exchange_record.edi_exchange_state, "output_error_on_send")

def test_create_facturae_file_without_organo_gestor(self):
self._activate_certificate(self.certificate_password)
self.move.action_post()
self.move.name = "2999/99999"
wizard = (
self.env["create.facturae"]
.with_context(active_ids=self.move.ids, active_model="account.move")
.create({})
)
self.partner.organo_gestor = False
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()

def test_facturae_face_0(self):
class DemoService(object):
def __init__(self, value):
Expand Down

0 comments on commit 1b262bb

Please sign in to comment.