From 9f2be4e593af372cebce63eb775c0a559e2a6822 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Tue, 10 Dec 2024 12:59:09 +0100 Subject: [PATCH] add bank account number to xml-export --- mixin.py | 20 ++++++++ template/Factur-X-1.07.2-extended/invoice.xml | 47 ++++++++++++------- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/mixin.py b/mixin.py index 10f4fe6..84fce84 100644 --- a/mixin.py +++ b/mixin.py @@ -9,6 +9,7 @@ import html from trytond.exceptions import UserError from trytond.i18n import gettext from trytond.tools import cached_property +from trytond.pool import Pool class EdocumentMixin(object): @@ -16,6 +17,25 @@ class EdocumentMixin(object): """ __slots__ = () + def company_bank_accounts(self): + """ get leist of bank account numbers, defined in config + + Returns: + list: records of model bank.account.number + """ + Configuration = Pool().get('account.configuration') + + result = [] + cfg1 = Configuration.get_singleton() + if cfg1 and cfg1.edocument_bank: + result.extend(list(cfg1.edocument_bank)) + else: + result.extend([ + y + for x in self.company.party.bank_accounts + for y in x.numbers]) + return result + @cached_property def seller_trade_address(self): """ get address of seller, throw exception if incomplete diff --git a/template/Factur-X-1.07.2-extended/invoice.xml b/template/Factur-X-1.07.2-extended/invoice.xml index ff32e24..8a7a664 100644 --- a/template/Factur-X-1.07.2-extended/invoice.xml +++ b/template/Factur-X-1.07.2-extended/invoice.xml @@ -12,7 +12,7 @@ this repository contains the full copyright notices and license terms. --> ${value.strftime('%Y%m%d')} - ${party.name} + ${this.quote_text(party.name)} ${id} @@ -26,13 +26,13 @@ this repository contains the full copyright notices and license terms. --> ${address.postal_code} - ${lines[0]} - ${lines[1]} - ${lines[2]} + ${this.quote_text(lines[0])} + ${this.quote_text(lines[1])} + ${(lines[2])} - ${address.city} + ${(address.city)} ${address.country.code} - ${address.subdivision.name} + ${this.quote_text(address.subdivision.name)} @@ -50,8 +50,8 @@ this repository contains the full copyright notices and license terms. --> - ${this.invoice.number} - ${this.invoice.description} + ${this.quote_text(this.invoice.number)} + ${this.quote_text(this.invoice.description)} ${this.type_code} ${DateTime(this.invoice.invoice_date)} @@ -71,8 +71,8 @@ this repository contains the full copyright notices and license terms. --> ${line.product.code} - ${line.product.name if line.product else ''} - ${line.description} + ${this.quote_text(line.product.name if line.product else '')} + ${this.quote_text(line.description)} @@ -99,10 +99,10 @@ this repository contains the full copyright notices and license terms. --> ${TradeParty(this.buyer_trade_party, this.buyer_trade_address, this.buyer_trade_tax_identifier)} - ${this.invoice.reference} + ${this.quote_text(this.invoice.reference)} - ${this.invoice.reference} + ${this.quote_text(this.invoice.reference)} @@ -114,11 +114,26 @@ this repository contains the full copyright notices and license terms. --> - ${this.payment_reference} + ${this.quote_text(this.payment_reference)} ${this.invoice.currency.code} - - 1 - + + + 1 + + + + + 30 + Wire transfer + + ${banknumber.number_compact} + ${this.quote_text(banknumber.account.bank.party.rec_name)} + + + ${banknumber.account.bank.bic} + + + ${TradeTax(tax.tax, tax.amount, tax.base)}