From f8c3616eab903684d32a042f36c00441ad78f20c Mon Sep 17 00:00:00 2001 From: Juanjo Garcia Date: Wed, 13 Dec 2023 13:13:58 +0100 Subject: [PATCH] Fix party view. Use "id_electronet" from party. Task #159227 --- invoice.py | 2 +- party.py | 2 -- party.xml | 7 +++++++ template_facturae_3.2.xml | 2 +- tests/test_module.py | 6 +++--- view/address_form.xml | 2 -- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/invoice.py b/invoice.py index c110cfc..5410a47 100644 --- a/invoice.py +++ b/invoice.py @@ -56,7 +56,7 @@ class Invoice(metaclass=PoolMeta): raise UserError(gettext('missing_facturae_party_info', party=party.rec_name, field=fields)) - if not party.addresses[0].id_electronet: + if not party.id_electronet: raise UserError(gettext('missing_facturae_party_info', party=party.rec_name, field='ID Electronet')) diff --git a/party.py b/party.py index 7247e91..31be09a 100644 --- a/party.py +++ b/party.py @@ -7,10 +7,8 @@ from trytond.pool import PoolMeta class Party(metaclass=PoolMeta): __name__ = 'party.party' id_electronet = fields.Char('Id Electronet') - #TODO: migrate id_electronet from party to address? class Address(metaclass=PoolMeta): __name__ = 'party.address' electronet_sale_point = fields.Char('Electronet Sale Point') - id_electronet = fields.Char('Id Electronet') diff --git a/party.xml b/party.xml index 05dbf51..352ec07 100644 --- a/party.xml +++ b/party.xml @@ -3,6 +3,13 @@ copyright notices and license terms. --> + + + party.party + + party_form + + party.address diff --git a/template_facturae_3.2.xml b/template_facturae_3.2.xml index 4c930a8..7e73902 100644 --- a/template_facturae_3.2.xml +++ b/template_facturae_3.2.xml @@ -43,7 +43,7 @@ {{ invoice.company.party.tax_identifier.code[:30] }} {# Optional. It could be the ID or the code #} - {{ invoice.company.id_electronet }} + {{ invoice.company.party.id_electronet }} {% if invoice.company.oficina_contable or invoice.company.organo_gestor or invoice.company.unidad_tramitadora or invoice.company.organo_proponente %} {% if invoice.company.oficina_contable %}{{ administrative_center(invoice.company.oficina_contable, '01', invoice.company.facturae_person_type, invoice.company.party.address_get('invoice')) }}{% endif %} diff --git a/tests/test_module.py b/tests/test_module.py index 96aaf20..f1ad4e7 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -60,7 +60,7 @@ class AccountInvoiceFacturaeElectronetTestCase(CompanyTestMixin, ModuleTestCase) company.party.identifiers = [tax_identifier] company.facturae_person_type = 'J' company.facturae_residence_type = 'R' - company.id_electronet = '100' + company.party.id_electronet = '100' company.party.save() company.save() @@ -68,7 +68,7 @@ class AccountInvoiceFacturaeElectronetTestCase(CompanyTestMixin, ModuleTestCase) address.facturae_person_type = 'J' address.facturae_residence_type = 'R' address.organo_proponente = 'Test Organo Proponente' - address.id_electronet = '100' + company.party.id_electronet = '100' address.organo_gestor = 'TEST' address.unidad_tramitadora = 'TEST' address.organo_proponente = 'TEST' @@ -122,6 +122,7 @@ class AccountInvoiceFacturaeElectronetTestCase(CompanyTestMixin, ModuleTestCase) tax_identifier = PartyIdentifier() tax_identifier.type = 'eu_vat' tax_identifier.code = 'BE0897290877' + party.id_electronet = '101' party.identifiers = [tax_identifier] party.save() @@ -135,7 +136,6 @@ class AccountInvoiceFacturaeElectronetTestCase(CompanyTestMixin, ModuleTestCase) 'electronet_sale_point': 'TEST', 'facturae_person_type': 'J', 'facturae_residence_type': 'R', - 'id_electronet': '101', 'organo_proponente': 'Test Organo Proponente', 'organo_gestor': 'TEST', 'unidad_tramitadora': 'TEST', diff --git a/view/address_form.xml b/view/address_form.xml index 5b171f7..c3ae609 100644 --- a/view/address_form.xml +++ b/view/address_form.xml @@ -6,7 +6,5 @@ this repository contains the full copyright notices and license terms. -->