Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][IMP]l10n_es_facturae: cambio restricciones Unidad Tramitadora y Oficina Contable #4052

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions l10n_es_facturae/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,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.unidad_tramitadora:
raise ValidationError(_("Unidad Tramitadora not provided"))
if not self.partner_id.oficina_contable:
raise ValidationError(_("Oficina Contable not provided"))
if not self.payment_mode_id:
raise ValidationError(_("Payment mode is required"))
if self.payment_mode_id.facturae_code:
Expand Down
12 changes: 0 additions & 12 deletions l10n_es_facturae/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,15 +751,3 @@ def _create_wizard_facturae_file(self):
.create({})
)
return wizard

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

def test_create_facturae_file_without_oficina_contable(self):
wizard = self._create_wizard_facturae_file()
self.partner.oficina_contable = False
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()
15 changes: 14 additions & 1 deletion l10n_es_facturae_face/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ def _get_l10n_es_facturae_excluded_status(self):

def validate_facturae_fields(self):
super().validate_facturae_fields()
if not self.partner_id.organo_gestor:
if (
self.partner_id.l10n_es_facturae_sending_code == "face"
and not self.partner_id.organo_gestor
):
raise ValidationError(_("Organo Gestor not provided"))
if (
self.partner_id.l10n_es_facturae_sending_code == "face"
and not self.partner_id.unidad_tramitadora
):
raise ValidationError(_("Unidad Tramitadora not provided"))
if (
self.partner_id.l10n_es_facturae_sending_code == "face"
and not self.partner_id.oficina_contable
):
raise ValidationError(_("Oficina Contable not provided"))
return
26 changes: 26 additions & 0 deletions l10n_es_facturae_face/tests/test_facturae_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,32 @@ def test_create_facturae_file_without_organo_gestor(self):
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()

def test_create_facturae_file_without_unidad_tramitadora(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.unidad_tramitadora = False
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()

def test_create_facturae_file_without_oficina_contable(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.oficina_contable = False
with self.assertRaises(exceptions.ValidationError):
wizard.create_facturae_file()

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