allow route-id to be optional

This commit is contained in:
Frederik Jaeckel 2024-12-05 10:47:05 +01:00
parent f47fb0fe01
commit 5f26a8cdb3
14 changed files with 132 additions and 10 deletions

View file

@ -11,12 +11,41 @@ from datetime import date
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
from trytond.modules.edocument_uncefact.tests.test_module import get_invoice
from trytond.exceptions import UserError
class EdocTestCase(ModuleTestCase):
'Test e-rechnung module'
module = 'edocument_xrechnung'
@with_transaction()
def test_xrechn_check_validator(self):
""" check validation of optional route-id
"""
Party = Pool().get('party.party')
party, = Party.create([{'name': 'P1'}])
self.assertEqual(party.xrechnung_routeid, False)
Party.write(*[
[party],
{
'xrechnung_routeid': True,
'identifiers': [('create', [{
'type': 'edoc_route_id',
'code': '1234'}])]}])
self.assertEqual(party.xrechnung_routeid, True)
self.assertEqual(party.get_xrechnung_route_id(), '1234')
self.assertRaisesRegex(
UserError,
"No XRechnung routing ID is stored for the party 'P1'.",
Party.write,
*[
[party],
{'identifiers': [('delete', [party.identifiers[0].id])]}]
)
@with_transaction()
def test_xrechn_export_xml_invoice(self):
""" run export - invoice