Fix party view.

Use "id_electronet" from party.

Task #159227
This commit is contained in:
Juanjo Garcia 2023-12-13 13:13:58 +01:00
parent 52a573fcc3
commit f8c3616eab
6 changed files with 12 additions and 9 deletions

View File

@ -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'))

View File

@ -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')

View File

@ -3,6 +3,13 @@
copyright notices and license terms. -->
<tryton>
<data>
<!-- party.party -->
<record model="ir.ui.view" id="party_view_form">
<field name="model">party.party</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="name">party_form</field>
</record>
<!-- party.address -->
<record model="ir.ui.view" id="address_view_form">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_form"/>

View File

@ -43,7 +43,7 @@
<TaxIdentificationNumber>{{ invoice.company.party.tax_identifier.code[:30] }}</TaxIdentificationNumber>
</TaxIdentification>
{# Optional. It could be the ID or the code #}
<PartyIdentification>{{ invoice.company.id_electronet }}</PartyIdentification>
<PartyIdentification>{{ invoice.company.party.id_electronet }}</PartyIdentification>
{% if invoice.company.oficina_contable or invoice.company.organo_gestor or invoice.company.unidad_tramitadora or invoice.company.organo_proponente %}
<AdministrativeCentres>
{% if invoice.company.oficina_contable %}{{ administrative_center(invoice.company.oficina_contable, '01', invoice.company.facturae_person_type, invoice.company.party.address_get('invoice')) }}{% endif %}

View File

@ -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',

View File

@ -6,7 +6,5 @@ this repository contains the full copyright notices and license terms. -->
<newline/>
<label name="electronet_sale_point"/>
<field name="electronet_sale_point"/>
<label name="id_electronet"/>
<field name="id_electronet"/>
</xpath>
</data>