export xrechnung 2.1 ok + test

This commit is contained in:
Frederik Jaeckel 2022-10-19 17:15:56 +02:00
parent 7e35688043
commit 1306f2a339
6 changed files with 152 additions and 60 deletions

View file

@ -7,6 +7,7 @@ from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
from trytond.modules.edocument_uncefact.tests.test_edocument_uncefact import get_invoice
from unittest.mock import Mock, MagicMock
from decimal import Decimal
class EdocTestCase(ModuleTestCase):
@ -21,9 +22,23 @@ class EdocTestCase(ModuleTestCase):
Template = pool.get('edocument.xrechnung.invoice')
Address = pool.get('party.address')
Identifier = pool.get('party.identifier')
Party = pool.get('party.party')
Bank = pool.get('bank')
BankAccount = pool.get('bank.account')
BankNumber = pool.get('bank.account.number')
invoice = get_invoice()
invoice.party.get_xrechnung_route_id = Mock(return_value='xrechn-route-id-123')
invoice.company.party.bank_accounts = [
Mock(spec=BankAccount,
currency=invoice.currency,
bank=Mock(spec=Bank, party=Mock(spec=Party, name='Bank')),
owners = [invoice.company.party],
numbers = [Mock(spec=BankNumber, type='other', number='123456')],
)]
invoice.description = 'description of invoice'
invoice.comment = 'note line 1\nnote line 2'
invoice.taxes[0].tax.rate = Decimal('0.1')
invoice.identifiers = [
Mock(spec=Identifier,
type='edoc_route_id',