add iban to tests

This commit is contained in:
Frederik Jaeckel 2024-12-10 13:56:40 +01:00
parent bd39ae228a
commit e0cd1a08f1
2 changed files with 30 additions and 5 deletions

View file

@ -120,6 +120,8 @@ class InvoiceTestCase(ModuleTestCase):
ActionReport = pool.get('ir.action.report') ActionReport = pool.get('ir.action.report')
ExportWiz = pool.get('account_invoice_xrechnung.runrep', type='wizard') ExportWiz = pool.get('account_invoice_xrechnung.runrep', type='wizard')
Tax = pool.get('account.tax') Tax = pool.get('account.tax')
BankAccount = pool.get('bank.account')
Bank = pool.get('bank')
country_de, = Country.create([{ country_de, = Country.create([{
'name': 'Germany', 'name': 'Germany',
@ -147,6 +149,19 @@ class InvoiceTestCase(ModuleTestCase):
with set_company(company1): with set_company(company1):
with Transaction().set_context({'company': company1.id}): with Transaction().set_context({'company': company1.id}):
bank_party, = Party.create([{
'name': 'Bank 123',
'addresses': [('create', [{}])]}])
bank, = Bank.create([{'party': bank_party.id}])
acc_company, = BankAccount.create([
{
'bank': bank.id,
'owners': [('add', [company1.party.id])],
'numbers': [('create', [{
'type': 'iban',
'number': 'DE02300209000106531065'}])]}])
# update report to 'pdf' # update report to 'pdf'
inv_report, = ActionReport.search([ inv_report, = ActionReport.search([
('model', '=', 'account.invoice'), ('model', '=', 'account.invoice'),
@ -155,7 +170,9 @@ class InvoiceTestCase(ModuleTestCase):
ActionReport.write(*[ ActionReport.write(*[
[inv_report], {'extension': 'pdf'}]) [inv_report], {'extension': 'pdf'}])
cfg1 = Configuration(xrechn_zugferd_report=inv_report) cfg1 = Configuration(
xrechn_zugferd_report=inv_report,
edocument_bank=list(acc_company.numbers))
cfg1.save() cfg1.save()
self.assertEqual(cfg1.xrechn_zugferd_report.name, 'Invoice') self.assertEqual(cfg1.xrechn_zugferd_report.name, 'Invoice')
create_chart(company=company1, tax=True) create_chart(company=company1, tax=True)

View file

@ -25,7 +25,7 @@ xml_from_pdf = """<?xml version="1.0" encoding="UTF-8"?>
<ram:LineID>1</ram:LineID> <ram:LineID>1</ram:LineID>
</ram:AssociatedDocumentLineDocument> </ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct> <ram:SpecifiedTradeProduct>
<ram:Name></ram:Name> <ram:Name/>
<ram:Description>Product 1</ram:Description> <ram:Description>Product 1</ram:Description>
</ram:SpecifiedTradeProduct> </ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement> <ram:SpecifiedLineTradeAgreement>
@ -76,9 +76,17 @@ xml_from_pdf = """<?xml version="1.0" encoding="UTF-8"?>
<ram:ApplicableHeaderTradeSettlement> <ram:ApplicableHeaderTradeSettlement>
<ram:PaymentReference>1</ram:PaymentReference> <ram:PaymentReference>1</ram:PaymentReference>
<ram:InvoiceCurrencyCode>usd</ram:InvoiceCurrencyCode> <ram:InvoiceCurrencyCode>usd</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans> <ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>1</ram:TypeCode> <ram:TypeCode>30</ram:TypeCode>
</ram:SpecifiedTradeSettlementPaymentMeans> <ram:Information>Wire transfer</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE02300209000106531065</ram:IBANID>
<ram:AccountName>Bank 123</ram:AccountName>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID/>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>
<ram:ApplicableTradeTax> <ram:ApplicableTradeTax>
<ram:CalculatedAmount currencyID="usd">20.00</ram:CalculatedAmount> <ram:CalculatedAmount currencyID="usd">20.00</ram:CalculatedAmount>
<ram:TypeCode>GST</ram:TypeCode> <ram:TypeCode>GST</ram:TypeCode>